Keywords and identifiers Overview

Keyword

  • Refers to a program, Java has defined the word has a special meaning.

Keyword Considerations

  • const and goto as a reserved word exist

Identifier

  • Refers to the program, we own custom content. For example, the name of the class, method names and variable names, etc., are identifiers.

Identifier naming rules:

Naming rules: a mandatory requirement
  • Identifiers can contain 26 letters (case sensitive), 0-9, $ (dollar sign) and _ (underscore).
  • Identifiers can not begin with a number.
  • Identifiers can not be keywords.
Naming convention: flexible recommendation (see name known Italian)

package

  • * The best domain name is upside down, requiring all lowercase letters

Class or interface

  • If a word is capitalized
  • If more than one word each word is capitalized (hump logo)

Methods or variables

  • If a word is all lowercase
  • If more than one word, capitalized the first letter of the second word

constant

  • If it is a word, all capital letters
  • If more than one word, the word all uppercase, with underscores to distinguish each word

 

 

 

 

Guess you like

Origin www.cnblogs.com/wurengen/p/10942754.html