Java keyword and reserved word summary, java keyword Summary
A brief description of common JAVA keywords and their usage
Abstract: an Abstract keyword in the Java language is used in class declaration to indicate that a class cannot be instantiated, but can be inherited by other classes. An abstract class can use abstract methods. abstract methods do not need to be implemented, but must be implemented in subclasses.
Break: a Java keyword used to change the execution process of a program. It immediately starts execution from the next sentence of the current statement. If there is a tag next to it, it will be executed from where the tag corresponds.
Case: keyword of the Java language, used to define a group of Branch selection. If a value is the same as the value given in the switch, it will be executed from the branch.
Catch: a keyword of Java used to declare a block that runs when a runtime error or non-runtime exception occurs in the try statement block.
Char: a keyword of the Java language used to define a character type.
Continue: a Java keyword used to interrupt the current loop process and re-execute it from the end of the current loop. If there is a tag following it, it will start to execute from the corresponding place of the tag.
Do: a Java keyword used to declare a loop. The ending condition of this loop can be set using the while keyword.
Double: a keyword of the Java language used to define a variable of the double type.
Else: a keyword of the Java language. if the conditions of the if statement are not met, the statement is executed.
Final: a keyword in Java. You can only define an object once and cannot change or inherit it later. More strictly speaking: A final-modified class cannot be subverted, a final-modified method cannot be overwritten, and a final-modified variable cannot change its initial value.
Finally: a keyword of the Java language used to execute a piece of code, regardless of whether an exception or runtime error occurs in the try Statement defined earlier.
Float: a keyword of the Java language used to define a floating point variable.
For: a Java keyword used to declare a loop. Programmers can specify the statements to be cyclic, introduce conditions, and initialize variables.
If: a keyword of the Java programming language, used to generate a condition test. if the condition is true, the statement under if is executed. A keyword of implements Java (TM) programming language, which is optional in the class declaration to specify the interface implemented by the current class.
Import: a keyword of the Java (TM) programming language. It specifies a class or the entire package to be referenced at the beginning of the source file, so that the package name does not need to be added during use.
Instanceof: A two-operand Java (TM) Language keyword, used to test whether the runtime type of the first parameter is compatible with the second parameter.
Int: a keyword of Java (TM), used to define an integer variable.
Class: a keyword of Java (TM), used to define a series of methods and constants. It can be implemented by the class through the implements keyword.
Long: a keyword of the Java language used to define a long type variable.
Private: a keyword of the Java language, used in the sound of a method or variable. It indicates that this method or variable can only be accessed by other elements of this class.
Protected: a keyword of the Java language used in the declaration of methods and variables, it indicates that this method or variable can only be in the same class, the elements in the subclass or the class in the same package are accessed.
Public: a keyword of the Java language used in the declaration of methods and variables. It indicates that this method or variable can be accessed by elements in other classes.
Return: a keyword of the Java language used to end the execution of a method. It can be followed by a value required in the method declaration.
Short: a keyword of the Java language used to define a variable of the short type.
Static: a keyword of the Java language used to define a variable as a class variable. The class only maintains a copy of the class variable, no matter how many instances the class currently has. "Static" can also be used to define a method as a class method. A class method is called by class name instead of a specific instance and can only operate class variables.
This: a keyword of the Java language, used to represent an instance of the class it appears. This can be used to sort class variables and class methods.
Throw: a keyword in the Java language that allows users to throw an exception object or any object that implements throwable.
Throws: a keyword of the Java language. It is used in the declaration of methods to indicate which exceptions this method does not handle. Instead, it is submitted to a higher layer of the program.
Transient: a keyword of the Java language used to indicate that a domain is not part of the object's serialization. When an object is serialized, the value of the transient variable is not included in the serialized representation. However, non-transient variables are included.
Try: a keyword of the Java language used to define a block that may throw an exception. If an exception is thrown, an optional catch Block will handle the exception thrown in the try block. At the same time, a finally statement block is executed, regardless of whether an exception is thrown.
Void: a keyword of the Java language. It is used in the method declaration of the Java language to indicate that this method does not return any value. "Void" can also be used to indicate a statement without any function.
Volatile: a keyword of the Java language. It is used in variable declaration to indicate that the variable is modified asynchronously by several threads running at the same time.
While: a keyword in Java, used to define a loop statement that is executed repeatedly. The exit condition of the loop is part of the while statement.
About break and continue
The continue statement is related to the break statement, but is rarely used. The continue statement is used to start the next loop of the for, while, Or do-while statement. In the while and do-while statements, the execution of the continue statement means that the test part is executed immediately. In the for loop statement, the execution of the continue statement means that the control is passed to the incremental part.
About goto and const
These two keywords are reserved for C ++ and cannot be used in java currently. If they appear in a Java program, the compiler can identify them and generate error messages.
Java has 50 keywords:
Abstract do implements private throw Boolean double import protected throws break else instanceof public transient byte extends int return true case false interface short try catch final long static void char finally native super volatile
Class float new switch while
Continue for null synchronized const
Default if package this gotoJava keyword list (51 groups in alphabetical order ):
Abstract, assert, boolean, break, byte, case, catch, char, class, const, continue, default, do, double, else, enum, extends, final, finally, float, for, if, implements, import, instanceof, int, interface, long, native, new, package, private, protected, public, return, short, static, strictfp, super, switch, synchronized, this, throw, throws, transient, try, void, volatile, while
Java reserved word list (14 groups in alphabetical order): Java reserved words indicate that the existing Java version is not used, but later versions may be used as keywords.
ByValue, cast, false, future, generic, inner, operator, outer, rest, true, var, goto, const, null
Haha, no matter what else, come to a few questions first, and make a correct response to your question _ ^
1, which of the following are keywords or reserved words in java?
A) if B) then c) goto d) while e) case f) sizeof
2, which of the following are java key words?
A) double B) Switch c) then d) instanceof
3, which of these are key words in java?
A) default B) NULL c) String d) throws e) long f) true
The answer is "1", "acde 2", "ad 3", and "adef ".
1. then and sizeof are not java keywords. If you are familiar with c or c ++, be careful when writing asp.
2. All keywords are in lower case, so Switch is not a keyword. Instanceof looks like a method name, but it is actually a keyword;
3. uppercase NULL is not a keyword in java. String is the class name of an encapsulation class in the java language, and is not a keyword.
Next, let's look at the system:
It is very important to correctly identify the keywords (keyword) and reserved words (reserved word) in java. Java keywords have special significance for java compilers. They are used to represent a data type or program structure. Reserved Words are reserved keywords for java. Although they are not currently used as keywords, they may be used as keywords in later versions.
Keyword list
Abstract boolean break byte case
Catch char class continue default
Do double else extends false
Final finally float for if
Implements import instanceof int interface
Long native new null package
Private protected public return short
Static super switch synchronized this
Throw throws transient true try
Void volatile while
Reserved Words
Const, goto
Notes
Identifies keywords in the java language. Do not confuse them with keywords in other languages such as c/c ++.
Const and goto are reserved words in java.
All keywords are in lowercase.
Friendly, sizeof is not a java keyword