Java基础总结

一、基础知识

(1)基础数据类型

byte、short、int、long(L后缀)、float(F后缀)、double、char、boolean(4个字节)

(2)包装类

Byte、Short、Integer、Long、Float、Double、Character、Boolean

缓存[-128, 127]:Byte、Short、Integer(java.lang.Integer.IntegerCache.high指定max)、Long

(3)String、StringBuilder、StringBuffer

(4)隐式转换

short s =1 ;  s += 1;, s+= 1.0;

(5)Math

Math.round

(6)switch

 byte、short、char、int、String(jdk7开始)

(7)位运算

<<左移 乘2

(8)重写规则

参数列表与被重写方法的参数列表一致

访问权限不能比父类中被重写的方法的访问权限更低

重写的方法不能抛出新的强制性异常,或者比被重写方法声明的更广泛的强制性异常

(9) final

1)作用范围:修饰类、修饰方法、修饰变量

2) final、finally、finalize

(10)日期

Date、Calendar(month 0-11)、LocalDateTime、SimpleDateFormat(非线程安全)

(11)异常

1)异常类型

Throw、Error(StackOverflowError)、Exception、RuntimeException(ArithmeticException、IndexOutOfBoundsException、NullPointerException)

2)异常关键字

throws、throw、try、catch、finally

(12)不可变对象(immutable object)

String、Integer 及其它包装类

(14)强制转换

int 强制转换为 byte 类型

二、

posted @ 2021-06-08 21:25  茅坤宝骏氹  阅读(4)  评论(0)    收藏  举报  来源