1. What is the difference between a Java keyword and a java reserved word?
java keyword (KeyWord): Java compilers have special meanings, they are used to represent a data type or to represent the structure of a program.
Java reserved word (Reserved Word): the keywords reserved for Java are not yet available, but may be used as keywords in the upgraded version.
What do 2.Java keywords and java reserved words include?
Java keywords (50) |
1 |
Access Control-related (3) |
Public (Common) protected (protected, other classes in the same package can be accessed) Private (privately, this class can be accessed) |
2 |
class, interface, abstract class correlation, instantiation object correlation (6) |
< Span style= "font-size:14px" >abstract (abstract) class (define Class), implements (Implementation), < Span style= "font-size:14px" >new (Create new object) |
3 |
Program Control related (13) |
if (if), else (otherwise),instanceof (determines whether an object is an instance of a class)
switch, case (a condition of the switch statement), break (jump out of loop/jump out of the switch statement block), Default branch of the switch statement, which executes when all of the case does not meet the criteria for (for Loop statement), do (loop statement, loop body will be executed at least once), while (when ...). Time), Continue (end this cycle, continue the next cycle) Return (returns ..., used to jump out of method), Goto |
4 |
Modifying methods, classes, attributes, and variable correlation (8) |
Static, final (final immutable),const Native (indicates that the method is implemented in non-Java code) Synchronized (thread-synchronized) Transient (modify fields that do not serialize) Volatile (tag fields may be accessed concurrently by multiple threads) STRICTFP (Strict/precise) |
5 |
Exception Handling related (5) |
Try (catch exception), catch (handle exception), finally (any exception will be executed) Throw (throws an exception object), throws (declares a method may throw an exception) |
6 |
Package related (2) |
Import (Ingest package) Package (Defining packages) |
7 |
Data type correlation (8) |
8 Basic data Types : Byte, shot, int, long, float, double, char, Boolean |
8 |
Variable reference related (3) |
Super (call the method/constructor of the parent class) This (indicates calling the current instance/calling another constructor) void (no return value) |
9 |
Other related (2) |
ASSERT (assertion condition is sufficient),enum (enum type) |
|
Java reserved words |
Byvalue, cast, false, future, generic, inner, operator, outer, rest, True, Var, goto (Jump to ...) ), const (constant), null |
Note: 1. The two keywords goto and const are reserved keywords for C + + and are not currently available in Java. (will be error when using)
2. All keywords are lowercase, and if any one of the letters in the keyword is capitalized, it is no longer a keyword. (case-sensitive in Java)
3. Then, sizeof, String, NULL, fiendly, and so on are not keywords, although they look very much like (possibly because of the case-sensitive relationship or may be a keyword in another language but not Java)
Java keywords and java reserved words