Quantcast
Channel: March 2015 – Program Creek
Viewing all articles
Browse latest Browse all 6

Print an Array in Java

$
0
0
This post summarizes 5 different ways of printing an array in Java. 5 Different Ways of Printing an Array Arrays.toString(arr) for(int n: arr) System.out.println(n+", "); for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + ", "); } System.out.println(Arrays.asList(arr)); Arrays.asList(arr).stream().forEach(s -> System.out.println(s)); The Winner Apparently, the first one is simple enough. If an ... Read more

Viewing all articles
Browse latest Browse all 6

Trending Articles