Some minor problems related to Java

18.12.15

Java a class can not implement two identical interfaces, compile-time error will be reported: Interface repeat


 

19.6.4

Constructor call sequence:

  1. Call parent class constructor, from the beginning inherit the top down recursive

  2. declaration order, call member class

Initialization method

  3. Call the current class constructor body

 

The actual initialization process:

  1. Before anything else happens, the storage space allocated to the object is initialized to binary zero

  2. The order of constructor calls


 19.6.5

 Set——

  HashSet: not stored in any order, but getting elements fastest - hash

  TreeSet: the comparison result in ascending order - to use red-black tree

  LinkedHashSet: added sorting order - use a hash, but the additional use of a linked list maintenance element insertion order

 

Each key can only be stored once Map--

  HashMap: Find technology provides the fastest and disorderly

  TreeMap: high Save button

  LinkedHashMap: insertion order to save the key, while retaining the HashMap query speed

 

Guess you like

Origin www.cnblogs.com/donkiss/p/10125144.html