The server on the VPS expires, and the HW is inaccessible, writing notes directly in the blog park.
Basic Article
1. The inheritance relationship of the collection class, the source code implementation principle, the initial size and how to grow.
-The list class has an initial size of 10, a load factor of 1, and an expansion to 1.5+1. The underlying is an object array called System.arraycopy for copying.
-Vector Ibid, the expansion factor is twice times, is synchronous, thread-safe.
-HashMap Initial size 16, load factor 0.75f, expansion to twice times. The bottom layer is the array + linked list, which calls resize () to adjust the position.
-Hashtable Initial size 11, load factor 0.75f, expansion to twice times +1. Thread-safe with segmented locks.
-TreeMap. The bottom red and black tree, can keep orderly, the efficiency is slightly low.
Specifying a size can improve performance. You may also ask the usual methods in collections and arrays.
2. The difference between interface and abstract class
-Interfaces can be implemented multiple, and abstract classes cannot be inherited multiple.
-abstract class can have attribute, interface can only have method.
-the method of an interface must not be implemented, and an abstract class can have an implementation method.
-the method in the interface is default and must be public , and the abstract class can be protected.
3. Instantiate a process for a class that has not been loaded.
See the book.
4. Error errors and exception exception classification, throws and throw differences.
Java exceptions (including exception and error) are divided into checked exceptions and unchecked exceptions:
-checked Exceptions: Other than RuntimeException and its subclasses, the exception class and its subclasses. The Java compiler examines it and forces the processing to be required.
-unchecked Exceptions: Includes run-time exceptions (RuntimeException with its subclasses) and errors (error).
What are the 5.Object methods?
-tostring,hashcode,equals
-clone,finalize,getclass
-wait,notify,notifyall
6. = =, equals, hashcode relations. It is possible to match a string to ask, possibly with set ask.
Interview Preparation & Summary-java basic article