Basic basic properties of the packaging 1. The packaging
The basic data types as the object of processing
● lei value of the basic types of objects is not, k may be used in the packaging JavaAPI packaged objects
● Java.lang package provides packaging
Packaging categories:
● numeric (Number Type): Byte, Short, Integer, Long, Float, Doubble
● The object type (Obejct type): Boolean, Character
note
● packaging without constructor with no arguments, all instances of the wrapper class are immutable. Once the object is created, they can not change the value inside.
● Each basic type of packaging has MAX_VALUE, MIN_VALUE.
2. The special nature of the packaging:
● packaging without constructor with no arguments
● numerical operations can be used as packaging
3. Basic Concepts and boxing and unboxing
● packing operation: the elementary data type to packaging, called packing.
● unboxing: packaging becomes the basic data types, called unpacking.
4. The special nature autoboxing
● In the automatic zhau packing, if the number is not -128-- between 127, the newly created object, whether the object returned in cache.
String class
1.String basic properties of the class
● When the string assigned to str1, that will allocate a string constant pool space, and this space so str1 points. If you then assign the string str2, this time directly to space will str2 str1 points. But if it is to make a new str2 again the same string, the string will be re-allocated a space in the heap space.
● String class materialized Once created, the content can not be changed, only the string assignment to change the spatial reference points
2.String basic operations like
StringBuffer和StringBuilder
1.StringBuffer and StringBuilder basic properties
● StringBuffer default space allocated 16
● StringBuffer StringBuilder speed and string operations much faster than the String
● StringBuffer is single-threaded, StringBuilder is multithreaded
● string operation, and can use StringBuffer StringBuilder after the first operation, converted to String
2.StringBuffer and basic operation StringBuilder
Old nine school community members produced