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 are the keywords in Java

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail what are the keywords in Java. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

1. Common keywords

If there is anything else that has not been written down, please let me know.

Keywords for defining data types class interface byte short int long float double char boolean void keywords for defining data type values true false null for defining flow control keywords if else switch case default while do for break continue return for defining access rights modifiers private protected public for defining classes, functions The keyword abstract final static synchronized of variable modifiers is used to define the relationship between classes. The keyword extends implements is used to define instance creation and reference instances, and to determine the keyword new this super instanceof for exception handling. Try catch finally throw throws is used for package keyword package import and other modifiers keyword native strictfp transient volatile assert2. Description of the function of the keyword

As shown below

Break is used in switch or loop statements to indicate the end of a break. Jumping out of a loop can directly end the statement. Continue is used in a loop statement to indicate the end of an interrupt, but it is different from break. It is to exit this loop and continue to execute the next loop. The common function of return is to end a method (exit a method). Jump to the meaning of the method interface interface called by the upper layer, which is used to define the interface. The static static modifier, whose members are shared by all objects of this class. You can also call the private permission modifier through the class name, which can modify member variables and member methods. The modified members can only be accessed in this class to hide the specific implementation details, provide public access methods, and improve security. This when member variables and local variable names are the same, they need to be modified with this. Whoever calls this method, the internal this of the method will represent. If this is not applicable, then the local variable hides the member variable super represents the identification of the parent class storage space (can be understood as the reference of the parent class, you can manipulate the members of the parent class) final because there is a phenomenon of method rewriting in inheritance, and sometimes we don't want the subclass to override the parent class's methods. In this case, java provides us with a keyword: final can modify classes, variables, and member methods. The modified class cannot be inherited; the modified method cannot be overridden; and the modified variable cannot be reassigned because the amount is actually a constant. The modifier basic data type means that the value cannot be changed; the modifier reference data type means that the address value cannot be changed. The body of the statement controlled by finally must be executed. Special case: jvm exits the function of (such as System.exit (0)) finally before implementing finally: used to release resources, the meaning of abstract abstraction will be seen in IO stream operations and database operations, which keywords can not coexist with abstract classes and abstract methods abstract? Private conflicts methods modified by private cannot be overridden if they cannot be inherited by subclasses, and our abstract methods also need to be overridden by subclasses, and methods that conflict with final cannot be overridden by subclasses. And our abstract method also needs to be overridden by subclass static meaningless because the method modified by static can be accessed directly through the class name, but our abstract method has no method body, so this access has no meaning of extends inheritance. Through it, an inheritance relationship can be created between classes. The meaning of implements implementation, through which you can create an implementation relationship between classes and interfaces. Instanceof tests whether the object on its left is an instance of the class on its right, and returns data of type boolean 3. 0. Key keywords description 3.1 3.1 instanceof

What is its function?

Instanceof is a binary operator of Java, and =, >

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

Development

Wechat

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

12
Report