Common tool operations
< p align = "center" > common tool jobs
< p class = "1" > I. fill in the blanks
2、 Multiple choice questions
3、 Judgment question
(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
(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): multithreading
StringBuffer is suitable for multi-threaded operation
StringBuilder is suitable for single thread operation
(5): efficiency
StringBuilder>StringBuffer>String
Tip: use the relevant methods of the string class to complete
2. Receive the age, score and enrollment time in string format input from the keyboard, convert them to integer, floating point number and date type, and output them on the console.
Tip: use wrapper class integer, double and date conversion class dateformat to implement
6、 Topic selection
Tip: use math Nextdouble() or nextint() implementations of random() and random classes
2. Print a visual calendar for a month