write a java code that declare an array which has 8 different numbers. Print the numbers of that array in reverse order.
//write a java code that declare an array which has 8 different numbers.
//Print the numbers of that array in reverse order
public class Main {
public static void main(String[] args) {
int[] array = new int[]{1,2,3,4,5,6,7,8};
for (int i = array.length-1; i >= 0 ; i--) {
System.out.print(array[i] + " ");
}
}
}
Comments
Leave a comment