• Post Reply Bookmark Topic Watch Topic
  • New Topic

can it be valid class declaration [I or [D?  RSS feed

 
viki Bhardwaj
Ranch Hand
Posts: 74
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Everyone,
as i know,the valid characters in java for class declaration are A-Z, a-z, 0-9 and some symbols like $,_ etc. now my doubt is that, whenever i try to create any class by prefix (,[,# etc then i get compilation error saying identifier expected but when i am doing with following below code...
int[] anArray=new int[4];
sopln(anArray);
then output =[I@e3e25a5, as like classname@hashcode
compare both ,here [I is a class name of int type. but according to coding convension it is not allowed but it is still work beautifully ...i dont know how???
so please give me the reason how it works???
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "[I" is an internal name in the JVM which means "array of int". It's ofcourse not a valid class name in Java source code.

Section 4.3.2 of the Java Virtual Machine Specification gives an overview of the internal names that exist.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!