Write a method printBackwards that prints an array of integers in reverse order, in the following format. For example, i
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a method printBackwards that prints an array of integers in reverse order, in the following format. For example, i
Write a method printBackwards that prints an array of integers in reverse order, in the following format. For example, if the array is {1, -3, 4, 7, 2}, the method should print the following: element [4] is 2 element [3] is 7 element [2] is 4 element [1] is - 3 element [@] is 1 1 Full Screen 5 6 ArrayPrinting.java + New public class ArrayPrinting { public static void main(String[] args) { int[][] testList { {1, 2, 3}, {1, 2, 3, 4}, {1, 2, 3, 5, 6}, {1, 2, 3, 5, 999, -1, 67, 55, 220, 77}, {71, 89, -54, 771, 8921, 11}, }; 8 9 10 11 12- 13 for (int[] numbers : testlist) { System.out.println(" printBackwards (numbers); } // Do not touch the code above -- these are test cases, and how your method will be called with those test cases } 15 16 17 18 19 20 // Just write your method below (no need to touch anything in the main method above)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!