The following is a contrived example I just made up to help me understand the inner workings of java.
public class Main {
public static void main(String[] args) {
int[] a;
a = new int[12];
System.out.println(a);
}
}
This prints out some garbage. Since a is passed by reference, I presume println
gets the memory address of a, and threats it as a string. I'am right here? Can you elaborate what happens exactly? Thanks. (note: I am not interested in how to print an array. I know that.)