1. Math.round()/Math.floor()/Math.ceil()
round:四舍五入往大的方向进;
floor:向下取整
ceil:向上取整
public class Test05_Math {
public static void main(String[] args) {
System.out.println(Math.round(11.5)); // 12
System.out.println(Math.round(-11.5)); // -11
System.out.println(Math.floor(11.7)); // 11
System.out.println(Math.ceil(11.1)); //12
}
}
2. 泛型的好处
- 类型安全
- 消除强制转换类型
- 在编译期保证数据类型的正确性。
3. 事务隔离级别
事物隔离级别是由数据库系统来实现的。
4. 多线程数据同步
在多线程下,如果是直接赋值就不需要进行数据同步,因为是原子性的操作,如果是先进行读取在赋值就需要进行同步。
5. 抽象类与接口的区别
JDK1.8之前:
- 抽象类可以有构造方法,接口中不能有构造方法
- 抽象类中可以有普通成员变量,接口中没有普通成员变量
- 接口中不能有静态方法,抽象类中因为有普通方法,故也可以有静态方法。