Java BASICS (1. Identifiers), java identifiers

Source: Internet
Author: User

Java BASICS (1. Identifiers), java identifiers

1. Identifiers: identifier

Names of class, method and variable are used for class name, method name, variable name

Begin with character, '_' or '$' the identifier cannot start with a number.

Case sensitive

No length limitation unlimited length

The identifier cannot be a java keyword, or a Chinese character can also be used as an identifier. It is not recommended at the time (involving encoding and cross-platform issues)

String is a java class. The class name can be used as an identifier.

In Java, sizeof is not an operator and can be used as an identifier.

Keywords and reserved words (const, goto, true, false, null) cannot be used as identifiers.

Public class Identifiers {public static void main (String [] args) {String $ abc = "abc1"; String _ abc = "abc2"; // compilation error, the identifier cannot start with a number // String 8abc = "abc3"; String China = "China"; String = "jaya"; int Integer = 22; // There is no sizeof operator in Java, so sizeof can be used as the identifier String sizeof = "sizeof"; System. out. println (String); // jaya System. out. println (Integer); // 22 }}

 

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.