Java basic Syntax day01_08 keyword _ identifier usage

Source: Internet
Author: User
Tags modifier

Definitions and features of keywords:

Definition: A string (Word) that is given special meaning by the Java language and used as a specialized purpose

Feature: all letters in the keyword are lowercase.

Keywords to define the data type:

Class (classes), Interface (interface), enum (enum), Byte, short, int, float, double, long, char, boolean, void

Used to define data types worth keywords:

True, FALSE, NULL

Keywords used to define Process control:

If, else, do, while, switch, case, default, for, continue, break, return

The keyword used to define the access permission modifier:

Private, public, protected

Keywords for defining classes, functions, variable modifiers:

Abstract, final, static, synchronized

Keywords used to define the relationship between classes and classes:

Extends, implements

Used to define keywords that establish instance reference instances and determine instances:

New, this, super, instanceof

Keywords for exception handling:

Try, catch, finally, throw, throws

Keywords used to define the package:

Package, Import

Other modifier keywords:

Native, strictfp, transient, volatile, assert

The sequence of characters used in Java to name features such as variables, methods, and classes is called identifiers.

Any place that can name itself is called the identifier.

Rules for defining legal identifiers:

1, by 26 letters of the letter case, 0-9, _ or $ composition, such as: Stuname, Stu_01name, _stu

2, the number can not start, such as: 09stu (this error)

3. You cannot use keywords or reserved words, but you can include keywords or reserved words. such as: Stunewname

4, Java strictly case-sensitive, length unlimited.

5. Identifiers cannot contain spaces.

Note: In the name of the time, in order to improve the reading, the name should be as far as possible "see the name of understanding."

Specification for name commands in Java:

1, Package Name: Multi-word composition, all the letters of the word are lowercase, such as: xxxxyyyy.

2. Class name, Interface name: When multiple words are composed, capitalize the first letter of all words, such as: xxxxyyyy.

3, variable name, function name (method name): When multiple words are composed, all words, except the first word Weishou letter lowercase, the first letter of the remaining words capitalized, such as: xxxxyyyy.

4, Constant name: multi-word composition, all the letters are capitalized, the word and the word with an underscore connection, such as: Xxxx_yyyy_zzzz.

Java basic Syntax day01_08 keyword _ identifier usage

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: 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.