public class HelloWorld {
public static void main(String[] args) {
//输出一个Hello,World!
String student = "言西月";
System.out.println("Hello,World!");
//单行注释
/*多行注释*/
//JavaDoc:文档注释
/**
* @Description HelloWorld
* @Author 言西月
*/
//有趣的代码注释
}
}
public class Demo01 {
public static void main(String[] args) {
//大小写十分敏感
String Man = "言西月";
String man = "言西月";
String 永劫无间 ="无间修罗";
System.out.println(永劫无间);
String Ahello = "言西月";
String hello = "言西月";
String $hello = "言西月";
String _hello = "言西月";
String _1 = "言西月";
//String _1#= "言西月";特殊符号不能命名
// String 1hello = "言西月";不能以数字开头
//String #hello = "言西月";不能以符号开头
//String *hello = "言西月";
}
}
标识符
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 private protected public
return strictfp short static super
switch synchronized this throw throws
transient try void volatile while
标识符注意点
Java所有的组成部分都需要名字。类名、变量名以及方法名都被称为标识符。
所有的标识符都应该以字母(A-Z或者a-z),美元符($)、或者下划线(_)开始
不能使用关键字作为变量名或方法名。
标识符事大小写敏感的
合法标识符举例:age、$salary、_value、__1_value
非法标识符举例:123abc、-salary、#abc
可以使用中文命名,但是一般不建议使用,也不建议使用拼音,很LOW