Java keywords and java reserved words

Source: Internet
Author: User
Tags goto java keywords

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



Access Control-related


Public (Common)

protected (protected, other classes in the same package can be accessed)

Private (privately, this class can be accessed)


class, interface, abstract class correlation, instantiation object correlation


< Span style= "font-size:14px" >abstract (abstract)

class (define Class),

implements (Implementation),

< Span style= "font-size:14px" >new (Create new object)


Program Control related


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


Modifying methods, classes, attributes, and variable correlation


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)


Exception Handling related


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)


Package related


Import (Ingest package)

Package (Defining packages)


Data type correlation


8 Basic data Types : Byte, shot, int, long, float, double, char, Boolean


Variable reference related


Super (call the method/constructor of the parent class)

This (indicates calling the current instance/calling another constructor)

void (no return value)


Other related


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.