Java Learning materials-identifiers, keywords

Source: Internet
Author: User
Tags volatile java keywords

1. Identifiers

(1) The sequence of characters used by Java to name features such as variables, methods, and classes is called an identifier. All the places where you can name them are called identifiers, and they obey the rules of identifiers.

(2) Java identifier naming rules:

identifiers consist of letters, underscores, dollar characters, or numbers.

identifiers should begin with a letter, underscore, and dollar symbol.

identifiers are case sensitive and have unlimited lengths.

(3) Unwritten rules: Java identifier Selection should be noted that the name is known and cannot be the same as the Java language keyword.

Examples of identifiers:

Legal identifier illegal identifier

HelloWorld Class

DataClass dataclass#

_123 12.3

$xx Hello World

3. Key words

(1) Some of the assignments in Java have specific meanings, and strings used for specialized purposes are called keywords. (most editors, such as Utraledit and EditPlus, will mark the keywords in a special way)

(2) All Java keywords are lowercase letters.

(3) Goto and const, although never used, are also reserved as Java keywords.

(4) List of Java keywords:

Abstract default if private This

Boolean do implements protected Throw

Break Double import public throws

byte else instanceof return

Transient (Java serialization provides a mechanism for persisting object instances, in order to turn off serialization on a domain of a particular object, you can precede the domain with a keyword transient )

Case extends int short try

Catch final interface static void

Char finally long

The STRICTFP (strictfp, or strict float point precise float strictfp keyword can be applied to a class, interface, or method. When declaring a method with the STRICTFP keyword, all of the float and double expressions in the method adhere strictly to the fp-strict limit and conform to the IEEE-754 specification. When using the STRICTFP keyword on a class or interface, all code in the class, including the initial setpoint and code in the nested type, is evaluated Strictly. Strict constraints mean that the results of all expressions must be the result of an IEEE 754 algorithm's expected operand, expressed in single-precision and double-precision formats. )

Volatile (theJava language provides a slightly weaker synchronization mechanism, the volatile variable.) To ensure that updates to the variables are notified to other threads, ensuring that the new values are immediately synchronized to main memory, and flushed from the main memory immediately before each use. When a variable is declared as a volatile type, the compiler and the runtime will notice that the variable is shared. )

Class float

Native(Java is not perfect, Java is not enough to run faster than the traditional C + + slower, Java can not directly access to the operating system (such as system hardware), for this Java uses the native method to extend the functionality of Java programs. )

Super while

Const ( in Java, Const is used as a reserved word for expansion, with the same reserved word for expansion and Goto. )

You can use the final keyword. Final can also be used to declare a method or class that cannot be inherited by a method or class that is declared final
In general C is the const Java with final )

For new switch null

Continue Goto package synchronized

Java Learning materials-identifiers, keywords

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: info-contact@alibabacloud.com 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.