OverLoad vs override jdk1.5 new features: package baseStrengthen; import static java. lang. math. *; public class StaticImport {public static int add (int x, int... args) {int sum = x; // for (int y = 0; y // {// sum + = args [y]; //} for (int arg: args) {sum + = arg;} return sum;} public static void main (String [] args) {theNew (); // System. out. println (add (2, 3, 4); // System. out. println (max (3, 6);} // New Features of JDK1.5, automatic unpacking and packing of public stat Ic void theNew () {Integer I = 3; System. out. println (I + 32); //-128 to 127 are in the same byte range and no new objects are created. Therefore, they belong to the same object. If they are not in this range, it is not the same object. // This is also a mode called the metadata mode. flyweight Integer i1 = 127; Integer i2 = 127; Integer i3 = 137; Integer i4 = 137; System. out. println (i1 = i2); System. out. println (i3 = i4) ;}} enumeration: a new feature of JDK1.5. It is very important. It used to be something in C language, and now it is necessary to retrieve the previous things. Set the values of some data types. Only the fixed values can be used. Other values cannot be used. Enumeration is equivalent to a class. The elements and members in enumeration are equivalent to objects. The enumeration constructor must be private. After the enumeration is followed by a bracket (), it indicates which constructor to use. The enumeration keyword. enum is equivalent to class. The external class only has the default and public modifier. The internal class can have four modifiers: public private, protected, and default. Braces are used after enumeration to represent its anonymous internal subclass. Package baseStrengthen; public class EnumDemo {public static void main (String [] args) {// WeekDay weekDay = WeekDay. SUN; // System. out. println (weekDay. nextDay (); // WeekDay1 weekDay1 = WeekDay1.FRI; // System. out. println (weekDay1); // System. out. println (weekDay1.name (); // System. out. println (weekDay1.ordinal (); // System. out. println (WeekDay1.valueOf ("SUN "). toString ();} public enum WeekDay1 {// RMB The prime list must be the first line SUN (2), MON (), TUE, WED, THI, FRI, SAT; private WeekDay1 () // The enumeration construction method must be private. {System. out. println ("first");} private WeekDay1 (int day) {System. out. println ("second") ;}} public enum TrafficLamp {RED {public TrafficLamp nextLamp () {return GREEN ;}}, GREEN {public TrafficLamp nextLamp () {return YELLOW ;}, YELLOW {public TrafficLamp nextLamp () {return RED ;}}; public abstract TrafficLamp nextLamp () ;}} reflection mechanism, Class is an upper-case Class, is a Class named Class. person p1 = new Person (); Person p2 = new Person (); obtain the number of bytecode Method: Class cls1 = Date. class // byte code of the Date type; p1.getClass (); Class. forName ("java. lang. string "); there are nine pre-defined Class objects. IsPrimitive (); whether it is the basic data type or whether it is the original type. IsArray (); whether it is a data type. Reflection: Reflection maps various components in the JAVA class into corresponding JAVA classes. Reflection is used for the framework. Method class, Constructor class. Reflection is performance-consuming, causing serious program performance degradation package baseStrengthen; public class ReflectTest {public static void main (String [] args) throws Exception {String str1 = "dalkfj "; class cls1 = str1.getClass (); Class cls3 = String. class; Class cls2 = Class. forName ("java. lang. string "); System. out. println (cls2 = cls1); System. out. println (cls1 = cls3); System. out. println (str1.getClass (). isPrimitive (); // whether it is the basic data type System. out. println (int. CIA Ss. isPrimitive (); // whether it is the basic data type System. out. println (int. class = Integer. class); System. out. println (int. class = Integer. TYPE) ;}} JUnit: JAVA testing tool for testing programs. JUnit is recommended for testing programs. Private constructors cannot be accessed from outside, but reflection can do this.