I'm a beginner and I am not able to understand how println() function actually works. When I pass primitive variable to it . It prints value of it. When I pass an object why does it print default toString() method definition? i.e.
getClass().getName() + '@' + Integer.toHexString(hashCode())
So when I am trying to print out an array.
System.out.println(Arrays.toString(array))
Am I overriding default method definition of toString of Object class or just converting Array to String using toString() method of Arrays class.
import java.util.Arrays;
public class RevString
{
public static void main(String[] args)
{
String str = "abcde";
int x=2;
String[] e =str.split("---");
System.out.println(e);
System.out.println(Arrays.toString(e)+ " " +"Primitive is " + " " + x);
}
}