Lowest price ever! Learn Generative AI for 48% less!
Get my discount0
What is the use of Arrays.toString() method ??
4 Answers
+ 2
This is the simplest way to print an array as a string. Remember Object.toString() not work for Arrays.
+ 1
double[] arr=new double [] {1,2,3,4};
System.out.println (arr.toString());
Just try to run the code. You will understand.
0
output is some ascii value
0
Yeah that's what I'm saying it considers an array as a typical object and returns default string i.e a'[ representing an array, followed by a character representing the primitive data type of array followed by an Identity Hex Code. So if you wanna print an array as a string you have to use Arrays.toString() method from util class