How does array class work in Java?
- by oks16
In Java, array is a class and extends Object. I am curious to know about this special array class. I don't find the class definition anywhere. Doing a getClass().getName() gives strange result.
String[] array = new String[]{"one","two"};
System.out.println(array.getClass().getName()); // prints [Ljava.lang.String;
I want to understand how array works under the hood. Is the array class definition hardcoded in the JVM?
Any resources, books, links on this will be helpful.
Thank you.