How does array class work in Java?
Posted
by oks16
on Stack Overflow
See other posts from Stack Overflow
or by oks16
Published on 2010-05-26T07:09:30Z
Indexed on
2010/05/26
7:11 UTC
Read the original article
Hit count: 193
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.
© Stack Overflow or respective owner