Answer to Question #155397 in Java | JSP | JSF for joy

Question #155397

write a java code that declare an array which has 8 different numbers. Print the numbers of that array in reverse order.


1
Expert's answer
2021-01-14T16:26:35-0500
//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] + " ");
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog