//NumberFormat is abstract. You must use the getInstance method to get a NumberFormat instance
// Calendar and DateFormat instances are created using getXxx() factory methods.
// the class Scanner default separator is a blank NOT a comma.
// The overriding talk() method has a weaker access modifier. so compile failed
//Multiple threads can be created using the same Runnable object, but a given thread can be started only once.if have more ,will compile but throws runtimeExcpeption
// The ^ operator returns true when exactly one operand is true.
// int method(int ... x) int method(int x) The methods are different signature, will overload
// An object can be collected even if it has a valid reference, if no live thread has access to the object
//objects reside in the heap; and the finalize method can send an object reference to another object, thereby an object's finalize method runs to completion, the object will not always be garbage collected.
//An enum may NOT be declared in a method
//If the JVM has a choice, it will select a method without varargs(变长参数...) before selecting a method with varargs.
//By default the readPassword() method does not echo the user's input.
//Only the Scanner class can use a stream as a source.
// because four different threads are started and each must have a unique Id.
//both classes have references to instances of each other: tightly coupled, only one references to another is loosely coupled
//It is legal to re-implement a private method in a sub-class, but Page does not know about Book's read method
// SortedMaps are abstract, Hashtable does NOT implement HashMap, and ArrayList is not a map
//The TreeSet is sorted alphabetically.
// If either operand is a String, the + operator concatenates.
//When enums are equal, both .equals and == always return true
// TreeSet<Animal> t = new TreeSet<Animal>(); TreeSet s = new TreeSet , Only the s and t can pass to a method (set<animal> a),
//The headMap() method returns the portion of the map whose keys are less than the key sent to it.
//The asList() method creates a fixed-size list that is backed by the array, so no additions are possible.
//Since Stuff implements Comparator, it must implement a compare method.
//Since Stuff implements Comparable, it must implement a compareTo method.
//x.X.doX(); x.X myX = new x.X(); myX.doX(); Fully qualified names require in a file with no import statements.
//在继承重写父类方法的时候,如果父类是void ,重写必须是void, 不是void则要求返回类型比父类等或小 。 权限必须相等或变大
//父类的final方法不能被子类覆盖
//Exception 和 Error 是继承于 Throwable 类 ,Exception 必需要catch , 而error不是,只是抛出来。
//Cannot use super in a static context
//implements is "is a" relationship
//子类 sub foo(int i) 没有重写父类base foo(int ... i) 那么 父类引用指向子类对象时 Base base = new sub(); base.foo()指向的是父类的foo,也就是说重载
//Two different array objects can never be ==, even if their contents are the same
//HashSet内部使用HashMap管理对象,添加对象到HashSet时,是将对象作为内部HashMap的key进行处理,若发现已存在hashCode相同且equals比较结果为true的对象,就认为该key已经存在,返回HashMap中的旧对象回来,而多个Person对象有不同的hashCode,因此全可以被加入到HashSet
//对于两个对象,如果hashCode一样, 没有重写equals ,还是允许插入。插入在冲突的下一个位置
//Integer等封装类都继承自 java.lang.Number
//equals比较为真的两个对象,必须要有相同的HashCode。这是Java规范约定的。
sjcp杂记
最新推荐文章于 2018-07-28 10:50:00 发布