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.
Pseudo Code:println(Array[i]); Concept: We will be using the toString() method of the Arrays class in the util package of Java. This method helps us to get the String representation of the array. This string can be easily printed with the help of the print() or println() method.
Finding the non repeating element in an array can be done in 2 different ways. Method 1: Use two loops, one for the current element and the other to check if the element is already present in the array or not. Method 2: Traverse the array and insert the array elements and their number of occurences in the hash table.
String[] array = { "a", "b", "c" }; System.out.println(Arrays.toString(array));
With Apache Commons Lang,
System.out.println(StringUtils.join(anArray,","));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With