"In-depth understanding of java virtual machine" study notes--Chapter 6: class file structure

The platform independence and language independence of the virtual machine:
(1) Virtual machines can run on various platforms, and these virtual machines can implement a platform-independent bytecode in how to achieve the purpose of "write once, run everywhere".
(2) In addition to being platform-independent, another feature of virtual machines is that they are language-independent, which means that not only the Java language, but other languages ​​can also run on the Java virtual machine. That is, programs in different languages ​​can be compiled into Class (bytecode) files by compilers in various languages, so as to run smoothly on the Java virtual machine.
The structure of the Class class file:

<!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tUeXBlIjoicGFyYWdyYXBoIiwic3R5bGVzIjp7InRleHQtaW5kZW50IjoxLCJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsImxpbmUtaGVpZ2h0IjoxLjc1fSwiYmxvY2tJZCI6IjY5NDctMTUyMDgyNDg2NDM0NyIsInJpY2hUZXh0Ijp7ImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWUsImRhdGEiOlt7ImNoYXIiOiJDIn0seyJjaGFyIjoibCJ9LHsiY2hhciI6ImEifSx7ImNoYXIiOiJzIn0seyJjaGFyIjoicyJ9LHsiY2hhciI6IuaWhyJ9LHsiY2hhciI6IuS7tiJ9LHsiY2hhciI6IuaYryJ9LHsiY2hhciI6IuS4gCJ9LHsiY2hhciI6Iue7hCJ9LHsiY2hhciI6IuS7pSJ9LHsiY2hhciI6IjgifSx7ImNoYXIiOiLkuLoifSx7ImNoYXIiOiLlrZcifSx7ImNoYXIiOiLoioIifSx7ImNoYXIiOiLkuLoifSx7ImNoYXIiOiLln7oifSx7ImNoYXIiOiLnoYAifSx7ImNoYXIiOiLljZUifSx7ImNoYXIiOiLkvY0ifSx7ImNoYXIiOiLnmoQifSx7ImNoYXIiOiLkuowifSx7ImNoYXIiOiLov5sifSx7ImNoYXIiOiLliLYifSx7ImNoYXIiOiLmtYEifSx7ImNoYXIiOiLvvIwifSx7ImNoYXIiOiLlkIQifSx7ImNoYXIiOiLmlbAifSx7Im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4qiJ9LHsiY2hhciI6IjgifSx7ImNoYXIiOiLkuLoifSx7ImNoYXIiOiLlrZcifSx7ImNoYXIiOiLoioIifSx7ImNoYXIiOiLov5sifSx7ImNoYXIiOiLooYwifSx7ImNoYXIiOiLlrZgifSx7ImNoYXIiOiLlgqgifSx7ImNoYXIiOiLjgIIifV19fV0=-->

A class file is a set of binary streams based on 8 bytes. Each data item is compactly arranged in the class file in strict order without any separators. This is the content stored in the entire class file. Almost all the necessary data when the program runs. When encountering a data item that needs to occupy more than 8 bytes of space, it will be divided into several 8-byte bytes for storage according to the high-order first.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326021377&siteId=291194637