1. Object creation and instantiation of variables in Java are divided into basic type variables and objects, including: Boolean, Byte, Short, Int, Long, CHAR, FLOAT, and DOUBLE, can be used directly after declaration. Declare the object, you cannot use it directly, you must create or return to the method call. For example: vector v; int count = v.size (); the usage is incorrect because the object V has not been created, and is not assigned (initialized). The correct usage is: vector v; v = new vector (); int count = v.size (); example calling to get an object: Calendar Cal = Calendar.getInstance (); Cal.SetTimeInmillis (System.currentTimeMillis () Someone wants to ask, for Java's built-in String, you can also use it directly, for example: string s; s = "How About EE2EE?"; Actually, when using the string "How About Ee2ee?", The system has created a String object for this string. The system translates it into the following statement: string S; "How About EE2EE?"); For array objects, the same reason, for example: int [] i = New i [3]; i [0] = 1; i [1] = 2; I [2] = 3; and int [] i = {1, 2, 3}; is equivalent. Obviously, the latter way is more concise. 2. Sub-objects and parent class objects The mutual conversion in the object-oriented object can be assigned to the parent class object directly, while the parent class object cannot directly assign a sub-object. There is a parent class ParentClass and subclass ChildClass: ParentClass P; ChildClass C = new childclass (); p = c; // correct, sub-objects can assign parent class object c = p; // Compile error, parent class object Directly assign a subclass object ParentClass P = new ParentClass (); c = p; // Compiling error, parent class object cannot directly assign a child class object C = (childclass) P; // run error, type conversion exception, because P is an instantiated object of the parent class, not the instantiated object of the subclass ParentClass P = new childClass (); // correct, sub-objects can assign the parent class object c = (childclass) p; // correct, because P Point to ChildClass Instantiation Object 3. The mutual assignment sub-object array of subclass object arrays and parent class object arrays can directly assign array to the parent class object, but otherwise.