Inkrementieren Sie ein Array -Java

/*Java program to increment the elements of an array by one and then print the updated array*/
import java.util.*;  

public class Main  
{  
   public static void main(String args[])   
   {  
       //Define the array and its elements
      int arr[]={10 ,20, 30 ,50, 40 ,60, 70, 89,71};
      
      //Define the length of the array
      int n=arr.length;
      
      //Display the original array
      System.out.println("Initial Array is :");
      for(int i=0;i<n;i++)
      {
          System.out.print(arr[i]+" ");
      }
      System.out.println("");
      
        for(int i=0;i<n;i++)
        {
            arr[i]=arr[i]+1;   //Increment the elements by one
        }
      
       //Display the updated array
      System.out.println("Updated Array is ");    
      for(int i=0;i<n;i++)
      {
          System.out.print(arr[i]+" ");
      }
      System.out.println("");
   }  
}
Ashamed Angelfish