Content deleted Content added
Update class file format major versions |
→Representation in a C-like programming language: use more Java-like layout |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 34:
===Sections===
There are 10 basic sections to the Java class file structure:
* '''[[Magic number (programming)|Magic Number]]''': <code>0xCAFEBABE</code>
* '''Version of Class File Format''': the minor and major versions of the class file
* '''Constant Pool''': Pool of constants for the class
Line 96:
| rowspan="2" | u2
| rowspan="2" | major version number of the class file format being used.<ref>{{Cite web|url=https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-4.html#jvms-4.1-200-B.2|title = Table 4.1-A. class file format major versions}}</ref><br />
Java SE 25 = 69 (0x45 hex),<br />
Java SE 24 = 68 (0x44 hex),<br />
Java SE 23 = 67 (0x43 hex),<br />
Line 231 ⟶ 232:
|}
===Representation
The following is a representation of a {{mono|.class}} file as if it were a C-style struct.
<syntaxhighlight lang="
struct
u4
u2
u2
u2
ConstantPoolInfo[constantPoolCount - 1] constantPool;
u2
u2
u2
u2
u2[interfacesCount] interfaces;
u2
FieldInfo[fieldsCount] fields;
u2
MethodInfo[methodsCount] methods;
u2
AttributeInfo[attributesCount] attributes;
}
</syntaxhighlight>
|