Java基础

  1. static修饰的方法默认都是final类型的,不能被子类覆盖

  2. Fields in interfaces are automatically public static final, and methods are public abstract. Classes or interfaces nested in an interface are automatically public and static (all nested interfaces are automatically static). 

  3. java com.abc.dollapp.main.Mainapp para0 para1  -> args[0]是para0,args[1]是para1

  4. byte、short、char类型数据在“x++”这样的一元运算中不会自动转换类型

  5. (x>d)?99.9:9  -> 9会转换成9.0

  6. char和short类型变量互相赋值时,需强制转换   -> char c=97; short s=(short) c;

  7. int i=1+new Integer(2)+2;  ok?

  8. continue语句中的标号必须定义在while,do…while和for循环前面;break语句中的标号必须定义在while,do…while,for循环和switch前面

  9. 非抽象父类->抽象子类->非抽象孙类

  10. When using reflection to set or get a field, the compiler does not have an opportunity to perform boxing.

  11. 集合中只能放置对象的引用,不能放置原生数据类型,  我们需要使用原生数据类型的封装类才能加入到集合中

  12. Integer.toString(intValue), not new Integer(intValue).toString() and not Integer.valueOf(intValue).toString()
  13. don't use myCollection.size() == 0, use myCollection.isEmpty(), The time complexity of any isEmpty() method implementation should be O(1) whereas some(not all) implementations of size() can be O(n).

接口继承

原文地址:https://www.cnblogs.com/drizzlewithwind/p/4964472.html