Saturday, 14 May 2016

java - Is there any way I can print String array without using for loop?





Is there any function in java like toString() to print a String array?



This is a silly question but I want to know if there is any other way than writing a for loop.



Thanks.


Answer




String[] array = { "a", "b", "c" };
System.out.println(Arrays.toString(array));

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...