Talk:Java class file: Difference between revisions

Content deleted Content added
WildBot (talk | contribs)
m WildBot was summoned
 
(8 intermediate revisions by 7 users not shown)
Line 1:
{{WikiProject Java}}banner shell|class=Start|
{{WikiProject Java|importance=low}}
{{User:WildBot/m01|dabs={{User:WildBot/m03|1|Compile}}, {{User:WildBot/m03|1|Octet}}|m01}}
}}
{{User:WildBot/m04|sect={{User:WildBot/m03|1|UTF-8#Java}}|m04}}
 
== Structure section needs a lot of work ==
 
Line 51 ⟶ 50:
 
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. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/77.188.94.56|77.188.94.56]] ([[User talk:77.188.94.56|talk]]) 15:56, 22 February 2011 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
 
: Indeed, byte, short, and smaller char constant values used in the code will never appear in the constant pool (and maybe this is worth mentioning in the article). But for other uses of constant pool entries, e.g. the compile-time values of static final variables, these types require an int entry. There is another difference between the general class file format and the byte code instructions: as the article states, there’s no padding in the class file format, but within byte code instructions there is an exception to this rule regarding the two switch instructions as their tables are aligned. [[Special:Contributions/77.12.173.11|77.12.173.11]] ([[User talk:77.12.173.11|talk]]) <span style="font-size: smaller;" class="autosigned"> — Preceding [[Wikipedia:Signatures|undated]] comment added 09:40, 16 April 2014 (UTC)</span><!--Template:Undated--> <!--Autosigned by SineBot-->
::without jdk why we cant run the java programm in comand promnt [[Special:Contributions/119.235.54.130|119.235.54.130]] ([[User talk:119.235.54.130|talk]]) 09:17, 3 April 2024 (UTC)