Web-android Engineer first-2-2 Understanding Java Identifiers

Source: Internet
Author: User
Tags java keywords

Source: http://www.imooc.com/code/1177

Q: Is the identifier God horse?

A: Identifiers are symbols that are used to name variables, classes, methods, and so on in a Java program.

There are several rules to follow when using identifiers:

1. Identifiers can consist of letters, numbers, underscores (_), dollar symbols ($) , but cannot contain other special characters, such as @,%, space, etc. , and cannot begin with a number . For example: 123name is not legal drop

2. Identifiers cannot be Java keywords and reserved words (Java reserved keywords, which may be used as keywords in later versions of the upgrade), but can contain keywords and reserved words. For example, void may not be used as an identifier, but myvoid can

3. Identifiers are strictly case-sensitive . So nirvana, be sure to distinguish between Chu Imooc and Imooc is two different identifiers Oh!

4. the name of the identifier should best reflect its role, to be known .

Task

Verify your study results!

Look carefully at the code in the editor, there is an error in line 1 , can you find the error and correct it?

 Public class helloworld%{    publicstaticvoid  main (string[] args) {        System.out.println ("Hello Imooc");}    }

Modified as follows

 Public class HelloWorld {    publicstaticvoid  main (string[] args) {        System.out.println ("Hello Imooc");}    }

Web-android engineer first-2-2 know Java identifiers

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.