JAVA注释
- 单行注释
//单行注释
- 多行注释
/*
123
456
7889
*/
- 文档注释
/**
4. @Description helloworld
5. @Author xugong
*/
注释并不会被执行,写给我们写代码的人看的
/***
6. _ooOoo_
7. o8888888o
8. 88" . "88
9. (| -_- |)
10. O\ = /O
11. ____/`---'\____
12. . ' \\| |// `.
13. / \\||| : |||// \
14. / _||||| -:- |||||- \
15. | | \\\ - /// | |
16. | \_| ''\---/'' | |
17. \ .-\__ `-` ___/-. /
18. ___`. .' /--.--\ `. . __
19. ."" '< `.___\_<|>_/___.' >'"".
20. | | : `- \`.;`\ _ /`;.`/ - ` : | |
21. \ \ `-. \_ __\ /__ _/ .-` / /
22. ======`-.____`-.___\_____/___.-`____.-'======
23. `=---='
24. 25. .............................................
25. 佛祖保佑 永无BUG
*/
————————————————
版权声明:本文为CSDN博主「Mr_YDK」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ydk888888/article/details/81563608
Java标识符
- 必须由字母、数字、下划线及美元符号组成;
- 不能以数字开头;
- 不能与关键字冲突;
- 不能和java类库的类名冲突;
- 应该使用有意义的名称。
java中的关键字
数据类型
- 基本类型
- 数值类型 整数,浮点,字符串
- Boolean类型 只有true和false
- 引用类型
- 接口
- 类
- 数组
public class Demo2 {
public static void main(String[] args) {
//整数拓展; 进制 二进制0b 十进制 八进制0 十六进制0x
int i = 10;
int i2 = 010;
int i3 = 0x10;
System.out.println(i);
System.out.println(i2);
System.out.println(i3);
System.out.println("======================================");
//浮点数拓展? 银行业务怎么表示? 钱
// BigDecimal 数学工具类
//float
//double
//最好使用完全浮点数进行比较
//最好使用完全浮点数进行比较
//最好使用完全浮点数进行比较
float f = 0.1f; //0.1
double d = 1.0/10; //0.1
System.out.println(f==d); //false
System.out.println(f);
System.out.println(d);
float d1 = 232323232323232f;
float d2 = d1 + 1 ;
System.out.println(d1==d2);//true
//字符串拓展?
char c1 ='a';
char c2 ='中';
System.out.println(c1);
System.out.println( (int)c1);//强制转换
System.out.println(c2);
System.out.println((int)c2);//强制转换
//所有的字符本质还是数字
//编码 Unicode表 97 = a ; 2字节 65536
//Uoooo UFFFF
char c3 = '\u0061';
System.out.println(c3);//a
//转义字符
// \t 制表符
// \n 换行
//....
System.out.println("hello\tworld");
System.out.println("hello\nworld");
//
String sa = new String("hello");
String sb = new String("hello");
String sc = "hello";
String sd = "hello";
//对象 从内存分析
//布尔值拓展
boolean flag = true;
if (flag==true){} //新手
if (flag){} //老手
}
}
心得
Java关键字严格区分大小写,string,s要大写。