Simplest way to print an array in Java
Posted
by Alex Spurling
on Stack Overflow
See other posts from Stack Overflow
or by Alex Spurling
Published on 2009-01-03T20:39:39Z
Indexed on
2010/05/12
21:04 UTC
Read the original article
Hit count: 254
What's the simplest way of printing an array of primitives or of objects in Java? Here are some example inputs and outputs:
int[] intArray = new int[] {1, 2, 3, 4, 5};
//output: [1, 2, 3, 4, 5]
String[] strArray = new String[] {"John", "Mary", "Bob"};
//output: [John, Mary, Bob]
© Stack Overflow or respective owner