Fail kelas Java
Fail kelas Java ialah sebuah fail dengan sambungan fail .class mengandungi kod bait Java yang boleh dilakukan pada mesin maya Java (JVM).
Susun atur umum
| ofset bait | saiz | jenis atau nilai | penerangan |
|---|---|---|---|
| 0 | 4 bytes | u1 = 0xCA hex |
angka ajaib (CAFEBABE) bagi menentukan fail mengikut format fail kelas |
| 1 | u1 = 0xFE hex | ||
| 2 | u1 = 0xBA hex | ||
| 3 | u1 = 0xBE hex | ||
| 4 | 2 bait | u2 | nombor versi minor bagi format fail kelas yang dipakai |
| 5 | |||
| 6 | 2 bait | u2 | nombor versi major bagi format fail kelas yang dipakai. Java SE 13 = 57 (0x39 hex), |
| 7 | |||
| 8 | 2 bait | u2 | bilangan constant pool, bilangan entri dalam jadual constant pool berikut. This count is at least one greater than the actual number of entries; see following discussion. |
| 9 | |||
| 10 | cpsize (variable) | table | constant pool table, an array of variable-sized constant pool entries, containing items such as literal numbers, strings, and references to classes or methods. Indexed starting at 1, containing (constant pool count - 1) number of entries in total (see note). |
| ... | |||
| ... | |||
| ... | |||
| 10+cpsize | 2 bytes | u2 | access flags, a bitmask |
| 11+cpsize | |||
| 12+cpsize | 2 bytes | u2 | identifies this class, index into the constant pool to a "Class"-type entry |
| 13+cpsize | |||
| 14+cpsize | 2 bytes | u2 | identifies super class, index into the constant pool to a "Class"-type entry |
| 15+cpsize | |||
| 16+cpsize | 2 bytes | u2 | interface count, number of entries in the following interface table |
| 17+cpsize | |||
| 18+cpsize | isize (variable) | table | interface table: a variable-length array of constant pool indexes describing the interfaces implemented by this class |
| ... | |||
| ... | |||
| ... | |||
| 18+cpsize+isize | 2 bytes | u2 | field count, number of entries in the following field table |
| 19+cpsize+isize | |||
| 20+cpsize+isize | fsize (variable) | table | field table, variable length array of fields
each element is a field_info structure defined in https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5 |
| ... | |||
| ... | |||
| ... | |||
| 20+cpsize+isize+fsize | 2 bytes | u2 | method count, number of entries in the following method table |
| 21+cpsize+isize+fsize | |||
| 22+cpsize+isize+fsize | msize (variable) | table | method table, variable length array of methods
each element is a method_info structure defined in https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6 |
| ... | |||
| ... | |||
| ... | |||
| 22+cpsize+isize+fsize+msize | 2 bytes | u2 | attribute count, number of entries in the following attribute table |
| 23+cpsize+isize+fsize+msize | |||
| 24+cpsize+isize+fsize+msize | asize (variable) | table | attribute table, variable length array of attributes
each element is an attribute_info structure defined in https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7 |
| ... | |||
| ... | |||
| ... |
Jika anda melihat rencana yang menggunakan templat {{tunas}} ini, gantikanlah dengan templat tunas yang lebih spesifik.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.