An identifier is a name that is given to a variable, class, or method. You can start with a letter, underscore, or dollar sign, case-sensitive, and no maximum length limit. (except keywords)
Key words
Access control |
Private |
Protected |
Public |
|
|
|
|
|
|
|
abstract |
class |
extends |
final |
implements |
interface |
native |
new |
static |
STRICTFP |
< Span style= "color: #0000ff;" >synchronized |
transient |
volatile |
|
|
|
|
&NBSP; |
Program control |
Break |
continue |
return |
do |
while |
if |
else |
for |
instanceof |
switch |
< Span style= "color: #0000ff;" >case |
default |
|
|
|
|
|
&NBSP; |
error handling |
try |
cathc |
< Span style= "color: #0000ff;" >throw |
throws |
|
", |
|
|
|
|
import |
package |
&NBSP, |
|
&NBSP; |
|
|
|
|
|
Boolean |
byte |
char |
double |
float |
int |
long |
short |
null |
True |
False |
|
|
|
|
|
|
|
Variable reference |
Super |
This |
void |
|
|
|
|
|
|
Reserved words |
Goto |
Const |
|
|
|
|
|
|
|
standard naming Conventions
class Name: first letter uppercase, the rest lowercase. If more than one word is composed, the first letter of each word is capitalized. Example:imagespride
Package name : A unique package name is always prefixed with all lowercase ascii letters and is a top-level domain name, usually com,edu,gov,mil,net,org, or 1981 ISO
The 3166 standard specifies the English double-character code for the identified country. The subsequent parts of the package name vary according to the naming conventions of each organization. Such naming conventions may be distinguished by the composition of a particular directory name (department), project, machine, or registered name (login names). For example: Com.sun.eng com.apple.quicktime.v2 Edu.cmu.cs.bovik.cheese, etc.;
interfaces: naming rules: Casing rules are similar to class names. For example:interface rasterdelegate;
method: The method name is a verb, in the form of a mixed case, the first letter is lowercase and the first letter of the word is capitalized. For example:run (); Runfast ();
variables: except for variable names, all instances, including classes, class constants, are mixed in case, the first letter is lowercase, and then the first letter of the word is capitalized. The variable name should not begin with an underscore or dollar sign, although this is syntactically permissible. Variable names should be short and descriptive. The choice of variable name should be easy to remember, that is, can indicate its use. Try to avoid the variable name of a single character unless it is a one-time temporary variable. Temporary variables are usually named I,j,k,m and N, which are generally used for integer types; c,d,e, which are generally used for character types. For example: Char C; int i;
instance variables: casing rules are similar to variable names, except that an underscore is required. Int_employeeid; String _name;
constants: declarations of class constants and ANSI constants should all be capitalized, with underscores separated between words. (try to avoid ANSI constants, easy to cause errors) staticfinal int min_width = 4; static final int max_width = 999;
Java Identifiers and naming conventions