Identifier: is to give classes, interfaces, methods, variables, and so from the name.
Composition rules:
A: capital or small letters
B: numeric characters
C: $ and _
Note:
A: can not start with a number
B: Java is not a keyword in
C: Java language strictly case-sensitive
common naming convention: see known name meaning
, for example: I would like to define a student class
class student {}
class S {}
package: in fact, the folder for the same class name to distinguish
all lowercase
single-stage: liuyi
multistage: cn.itcast
CN
itcast
class or interface:
one word: the first letter of the word must be capitalized
example: Student, Dog
multiple words: first letter of each word must be capitalized
example: HelloWorld, StudentName
A method or a variable:
a word: first word lowercase
example: main, age
plurality of words: starting from the second word, the first letter of each word capitalized
example: studentAge, showAllNames ()
constants:
a word: all caps
Examples : the PI
plurality of words: each capital letters, separated by _
example: STUDENT_MAX_AGE
Common naming rules: See name EENOW
Guess you like
Origin blog.csdn.net/zhengzhongz/article/details/103821359
Ranking