Thinking in reading note 6

xiaoxiao2021-03-06  46

Two methods for multiplexing multiplexes in multiplexing classes: a. Create an old class object directly in the new class, called compost, b. Create a new one, with the original class belongs to the same class, the whole process accepted the form of the old class, adding new code to the inside without the premise of it, called inheritance. 2. Initialize the three times of Reference: a. When the object is defined, it has been completed before the constructor is complete. b. In this class constructor. C. This is called Lazy Initialization, lazy loading, can reduce the overhead of the program. 3. A MAIN method function can be added in each class without the need for a PUBLIC, so that unit testing can be performed in the MAIN function. Java will call the MAIN method of the class you given in the command line. 4. A general guidelines for inheritance: set the data into private, set the method to public, and of course, it is necessary to adjust. 5. Access the base class in the subclass, you can use the super key. Super.method (); 6.java will automatically call the constructor of the base class automatically. The construction behavior is developing from the base class, i.e., the constructor of the high-level base class is now attached, and then the constructor is called from the top down. If the base class constructor you want to call is a parameter, you must first use Super Keywords and the appropriate parameters in your subclasses and the constructor of the base class. For the part-style constructor, call the base class constructor should be the first thing it does. The compiler will force the constructor of the base class in the first time the constructor of the derived class. For example: Class Plate {Plate (INT I) {System.out.pritln ("Plate Constructor");}}

转载请注明原文地址:https://www.9cbs.com/read-82959.html

New Post(0)