Advertisement
Guest User

ArrayPrinter

a guest
Apr 7th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1.  
  2. public class ArrayPrinter {
  3.  
  4.     public static void main(String[] args) {
  5.         // You can test your method here
  6.         int[] array = new int[5]; //{5, 1, 3, 4, 2};
  7.         array[0] = 5;
  8.         array[1] = 1;
  9.         array[2] = 3;
  10.         array[3] = 4;
  11.         array[4] = 2;
  12.         printNeatly(array);
  13.     }
  14.  
  15.     public static void printNeatly(int[] array) {
  16.         // Write some code in here
  17.         System.out.println(array[0] + ", " + array[1] + ", " + array[2] + ", " + array[3] + ", " + array[4]);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement