Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java print array backwards

int [] arr = new int [] {1, 2, 3, 4, 5};

for (int i = arr.length-1; i >= 0; i--) {  
            System.out.print(arr[i] + " ");  
}

//output: 5 4 3 2 1
Source by www.javatpoint.com #
 
PREVIOUS NEXT
Tagged: #java #print #array
ADD COMMENT
Topic
Name
5+2 =