public class Demo01 {
public static void main(String[] args) {
System.out.println("Hello,World!");
}
}
注释,标识符及关键字
注释
标识符
- 所有的标识符要以大小写,_ ,$ 开头,其它不可。之后可以是任意组合
- 不能使用关键字作为变量名或者方法名
- 标识符大小写敏感
public class Demo02{
public static void main(String[] args){
int num = 123;
int Num = 123;
int _num = 123;
int $num = 123;
}
}
关键字
![在这里插入图片描述](https://img-blog.csdnimg.cn/82b25a6236f74a89aafa00e620797a52.webp#pic_center)
abstract | break | byte | boolean | catch |
---|
case | char | class | continue | default |
do | double | else | extends | false |
final | float | for | finally | if |
import | implements | int | interface | Instanceof |
long | length | native | new | null |
package | private | protecked | public | return |
switch | synchronized | short | static | super |
try | true | this | throw | throws |
threadsafe | transient | void | volatile | while |