Keywords and identifiers for Java

Source: Internet
Author: User

As a programming language, Java, like other languages, has the basic elements of character sets, identifiers, and keywords, variables, constants, statements, and other programming languages.

1. Key words

Abstract Boolean Break Byte Case
Catch Char Class Const Continue
Default Do Double Else Extends
Assert Final Finally Float For
Goto If Implements Import instanceof
Int Interface Long Native New
Strictfp Package Private Protectde Public
Return Short Static Super Switch
Synchronized This Throw Shrows Transient
Try void Volatile While

In these keywords conse and goto cannot be used in Java, they are simply used when converting C and C + + to Java code. In addition Java has three reserved words, true, false, null these three reserved words are literal values, and not the key is. However, they cannot be used as identifiers and have specific meanings for Java programming.

2. Identifiers

in Java, we need to identify many elements of the code, including the class name, method, field, variable, package name, and so on. The name we choose is called an identifier, and the following rules are followed:

(1) Identifiers cannot be keywords or true, false, or null.

(2) identifiers can contain letters, numbers 0-9 underscores (_), or dollar signs ($).

(3) The first character of an identifier must be a letter, an underscore (_), or a dollar sign ($).

(4) Identifiers are case-sensitive and do not specify a maximum length.

Keywords and identifiers for Java

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.