Java注释、标识符、关键字(Java comments, identifiers, keywords)

Java注释、标识符、关键字

注释

单行注释以“//” 开始;多行注释以 “/*” 开始,以“*/”结束;文档注释以 “/**” 开始,以“*/”结束。

  • 单行注释
  • 多行注释
  • 文档注释
// 单行注释
/*
	多行注释
*/
/**
 * 文档注释
 */

标识符

Java中所有组成部分都需要名字。类名、方法名以及变量名都被称为标识符

  • 以字母(A-Z或者a-z)、下划线(_)、美元符号($)开始;
  • 首个字符后可以是数字、字母、下划线、美元符号
  • 不可使用Java的关键字
  • 严格区分大小写

关键字

abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for 
goto if implements import instanceof int interface long native new package frivate protected public return strictfp short static 
super switch synchronized this throw throws transient try void volatile while
abstract assert boolean break byte
case catch char class const
continue default do double else
enum extends final finally float
for goto if implements import
instanceof int interface long native
new package frivate protected public
return strictfp short static super
switch synchronized this throw throws
transient try void volatile while
————————

Java comments, identifiers, keywords

notes

Single line comments start with “/ /”; Multi line comments start with “/ *” and end with “* /”; Document comments start with “/ * *” and end with “* /”.

  • Single-Line Comments
  • multiline comment
  • Documentation Comments
// 单行注释
/*
	多行注释
*/
/**
 * 文档注释
 */

identifier

All components in Java need names. Class names, method names, and variable names are called identifiers

  • Start with letter (A-Z or A-Z), underscore (), dollar sign ($);
  • The first character can be followed by numbers, letters, underscores and dollar symbols
  • Java keywords are not allowed
  • Strictly case sensitive

keyword

abstract assert boolean break byte case catch char class const continue default do double else enum extends final finally float for 
goto if implements import instanceof int interface long native new package frivate protected public return strictfp short static 
super switch synchronized this throw throws transient try void volatile while
abstract assert boolean break byte
case catch char class const
continue default do double else
enum extends final finally float
for goto if implements import
instanceof int interface long native
new package frivate protected public
return strictfp short static super
switch synchronized this throw throws
transient try void volatile while