Have a Question?

If you have any question you can ask below or enter what you are looking for!

Overview of Class file Structure in Java?


1. Magic Number

  • The first four bytes of the class file is the magic number. This is a predefined value used by JVM to identify a .class file is generated by the valid compiler or not.
  • The value should be “OXCAFEBABE”.
  • Note:- Whenever we are executing a java class if JVM unable to find the valid magic number then we will get runtime exception to say java.lang.classFormateError:- incompatible magic value.

2. Minor_version, major_version

  • In Java .class file structure contains Major and minor versions represent .class file version.
  • JVM will use these versions to identify which version of compiler generates the current .class file.
  • Note:- lower version compiler generated .class file can be run by higher version JVM but higher version compiler generated .class files can’t be run by lower version JVMs. If we are trying to run we will get RuntimeException saying java.lang.unsupportedClassVersionError.
  • Overview of Class file Structure in Java?

Constant pool count

  • In Java .class file structure constant pool count represents no of the constant present in the constant pool

Constant pool array[]

  • In Java .class file structure constant pool aarays represents info. About constant present in the constant pool.


  • It provides info. About modifiers which are declared to the class.


  • Java .class file structure represents the fully qualified name of the class.


  • It represents the fully qualified name of the immediate superclass of the current class.


  • In Java .class file structure interface_count returns no of interface implemented by the current class.


  • It returns interface information implemented by the current class.


  • It represents no of fields present in the current class.


  • It represents fields of info. Present in the current class.


  • It represents no of methods present in current class.


  • It provides info. All method present in current class.


  • It returns no of attribute present in current class.


[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_separator css_animation=”bounceInRight”][/vc_column][/vc_row][vc_row css_animation=”rollIn”][vc_column width=”1/2″][ultimate_ctation ctaction_background=”#1e73be” ctaction_padding_top=”15″ ctaction_padding_bottom=”15″ ctaction_link=”url:https%3A%2F%2Fwww.java4us.com%2Fwhat-is-hashtable-in-java-with-example%2F|title:What%20is%20Hashtable%20in%20Java%20with%20Example%3F” text_font_size=”desktop:15px;”]What is Hashtable in Java with Example?[/ultimate_ctation][/vc_column][vc_column width=”1/2″][ultimate_ctation ctaction_background=”#1e73be” ctaction_padding_top=”15″ ctaction_padding_bottom=”15″ ctaction_link=”url:https%3A%2F%2Fwww.java4us.com%2Fwhat-is-a-collection-class-in-java%2F|title:What%20is%20a%20Collection%20class%20in%20Java%3F|target:_blank” text_font_size=”desktop:15px;”]What is a Collection class in Java?[/ultimate_ctation][/vc_column][/vc_row]

Tags:  , , , , ,

Leave a Reply

Your email address will not be published.