java class library --coreJava

Wrapper class:

 The base class of all object types in Java is the Object type, and the wrapper class is the class used to convert the basic data type to the Object type.

 Autoboxing: Primitive data types are directly assigned to the corresponding object types.

 Automatic unboxing: The object type corresponding to the wrapper class is directly assigned to the base data type.

Autoboxing uses the same instance object for values ​​from -128-127.

 

Class library introduction:

String: Represents a string that cannot be modified

StringBuilder: It is a new feature after 1.5, used for the operation of variable strings, with high efficiency

StringBuffer: used for operations on mutable strings, inefficient and safe

 

The usage of final in String:
final StringBuffer a = new StringBuffer("111");
final StringBuffer b = new StringBuffer("222");
a=b;//This sentence does not pass
final StringBuffer a = new StringBuffer("111 ");
a.append("222");// Compilation is
visible, final is only valid for the "value" (ie memory address) of the reference, it forces the reference to only point to the object originally pointed to, changing its point will results in a compile-time error. As for changes to the object it points to, final is not responsible.

 Note: It must be noted that the reference is immutable, that is, the address value points to cannot be changed, but the content of the space pointed to by the address value can be changed.

 

gather:

set: The sorting method is uncertain, and the access and operation of its members are carried out through the reference of the set object. So there can be no repeating elements.

list: The main feature is that its objects are stored in a linear fashion, with no specific order, only a beginning and an end, which is of course different from a Set which has no order at all. It is a linked list, a chain must have an order, this order is not necessarily.

map: key-value pairs come in pairs.

Queue:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326350987&siteId=291194637