01. New Features of Java1.5 and 01. New Features of Java1.5
I. Static Import
Import static methods and static variables in one class into another class
|
PackageJDK_New_Characters;
ImportStaticJava. lang. Math. *; // static import is equivalent to putting both static methods and static variables in Math
// StaticImport, so StaticImport can directly use these methods and variables
PublicClassStaticImport {
PublicStaticVoidMain (String [] args ){
System.Out. Println (Max(7, 8 ));
System.Out. Println (Random());
}
} |
Ii. variable parameters
Iii. Enhanced for loop 4. Automatic unpacking and unpacking of basic data types 5. flyweight)
Objects that occupy a small amount of space and have the same attributes are simplified into one. different attributes are encapsulated as parameters of the method, which are called external States. The same attributes are called internal states. For example: the value range is [-128 ~ 127] Only One Integer object
Vi. enumeration (Enum) 1. function 2. Example 7. Annotations