Summary of important concepts of common Java classes

Is to automatically convert the basic data type to the wrapper type;

   (1)Integer it = 200;

Actually: integer it3 = integer valueOf(100);

Automatic packing function: automatically load int type into integer, box first, and then assign value

Is to automatically convert the wrapper type to the basic data type.

  (2) Integer it2 = it+it1;

Actually: integer it2 = integer valueOf(it2.intValue() + it3. intValue());

First unpack it2 and it3, then add them to get a value of int type, then do the boxing operation on the value of int type, and finally assign a value

(1): generate a new object

String will generate new objects, which is inefficient and wastes memory space

StringBuffer and StringBuilder do not generate new objects, but operate in the original buffer

(2) : variable

String is immutable

StringBuffer, StringBuilder variable

(3) : is it safe

StringBuffer is secure

StringBuilder is not secure

(4) : whether to Multithread

StringBuffer is suitable for multi-threaded operation

StringBuilder is suitable for single thread operation

(5) : efficiency

StringBuilder>StringBuffer>String

3.String str=”bjsxt”; And string STR = new string ("bjsxt"); Differences between

4.java. sql. Date and Java util. Relationship and difference of date

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>