Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the access flag for Class files in the JVM virtual machine

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what is the access flag of the Class file in the JVM virtual machine. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

I. the concept of access flags

After the constant pool ends, the next two bytes represent the access flag, which is used to identify access information at the class or interface level, including: whether the Class is an interface or a class; whether it is defined as a public type; whether it is defined as an abstract type; if so, whether it is declared as a final, and so on.

There are two bytes (16 bits) in access_flages that can be used, and the flag that is not used is required to be 0. If there are multiple access flags, they are grouped together in a "OR" way.

Second, access flag specific meaning flag name value meaning ACC_PUBLIC0x00 01 is Public type ACC_FINAL0x00 10 is declared final, only the class can set whether ACC_SUPER0x00 20 allows the use of new semantics of invokespecial bytecode instructions. ACC _ INTERFACE0x02 00 flag whether this is an interface ACC_ABSTRACT0x04 00 is an abstract type, for an interface or abstract class, the secondary flag value is true Other types are false ACC_SYNTHETIC0x10 00 flags, this class does not generate ACC_ANNOTATION0x20 00 flags from user code, this is an annotated ACC_ENUM0x40 00 flag, and this is an enumeration III. Case 1

Define a class:

Public class HelloWord {}

0021 can be inferred to be a combination of ACCPUBLIC and ACCSUPER through OR.

Through the command javap-verbose HelloWord.class to check, it is found that it is indeed a combination of ACCPUBLIC and ACCSUPER:

How is 06 01 combined? Check it through the command javap-verbose HelloWord.class and find that it is a combination of ACCPUBLIC, ACCINTERFACE and ACC_ABSTRACT:

On the JVM virtual machine Class file access flag is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report