Talk:Java class file: Difference between revisions

Content deleted Content added
m moved Talk:Class (file format) to Talk:Java class file: Requested at Wikipedia:Requested moves as uncontroversial (http://en.wikipedia.org/w/index.php?title=Wikipedia:Requested_moves&oldid=405453180#movereq-Class_.28file_format.29)&wpMove...
No edit summary
Line 49:
 
So there is some difference to the description text for the major version given in this article, at least some JDK 1.4.x versions seem to be using major 46 instead of 48, and at least some 1.2.x versions use 45 instead of 46.
 
== boolean, byte, and short in constant pool ==
 
The article states, "Other integral types appearing in the high-level language, such as boolean, byte, and short must be represented as an integer constant."
 
While it's true that if you wanted to include a constant of one of these types into the constant pool, an integer entry
was needed, a standard compiler will never do so as there are instructions (bipush and sipush) for using small integer values directly without the need for a constant pool entry at all.
 
Since the Java bytecode makes no difference between these integral types, all int values fitting into the short value range are encoded this way. Only values outside this range or needed for initializing compile-time constants (e.g. static final fields) will end up in the constant pool.