Chapter 2, all things are all objects
One. All objects must be established by you. Where to store 1. Register: We can't control it in the program 2. Stack: Store the basic type of data and object's Reference, but the object itself does not store in the stack, but stored in Heap 3. HEAP: Store NEW Data 4. Static Storage: Static member stored in the object 5. Constant Storage: Storage constant 6. Non-RAM: Hard disk or the like permanent storage space 2. Special case: Basic type Basic Type Data is stored in Stack, which is stored. When the object is generated, only the reference to the object is stored in the STACK, used to point to an object, and the object itself is stored in the HEAP. 3. Arrse in Java When you generate an array of a storage object, the actually generated is actually an array of reference. After the quota is built, each ofes each Reference will be automatically set to null, indicating that "do not point to any object". two. Establish a new data type: Class1. Data members and functions 1.1 Basic members' default 1) When a member of the Class is a basic type, even if you don't provide the initial value, Java still guarantees that it has a default. 2) Only when the variable identity is "member in the class, Java guarantees the initial value for this variable. II. Function (mehtods), Return Values 1. Return Values 1. Quoter Columns When the object is the object, the object's Reference. IV. Note With Embedded Document Java to provide two annotations: / * xxxx * /, // xxxx
Chapter 3 Control Procedure Process
One. Using the Java operator 1. Relational Operators 1.) When comparing the two objects to the relationship operator, the object reference, such as:
Integer n1 = new integer (3); integer n2 = new integer (3); system.out.println (n1 == n2);
The result is False, because the two Object Reference (N1 and N2) values are different 2) The default behavior of QUALS () is also a Reference to compare. However, Class in Java overwrites the Equals method, such as:
Integer n1 = new integer (3); integer n2 = new integer (3); system.out.println (n1.quals (n2)); // value true
2. Logic operators 1) can only apply both, or, not, on the Boolean value. If the value on both sides of the logical operator exists, it will be wrong, such as:
INT test1 = 1; system.out.println ((TEST && 1 <2); // Edited error, TEST is a non-boolean value
3. Displacement Operator If the displacement object operated is CHAR, BYTE, SHORT, the value will be promoted to int, and the calculation result will be int. two. Process control 1. Iteration 1.1 Command The comma operator can only be used in INITIALIZATION and STEP in the control expression of the for loop, such as: for (int i = 0, j = i 1; i <5; i , J = I * 2) 1.2 Break and ContinueBreak indicate exit loop; Continue means exiting this loop and come back to cycle start position. 1.3 Labellabel only works before it is placed, and inserting any statements between Label and iterative statements will not work. 2. The selector in SwitchSwitch must be int or char type, such as: float i = 2; switch (i) // will be wrong because i is not one of int or char
3. Calculation details 1) Turn from FLOAT or Double to integer values, always in a completely discarded decimal manner. 4. Math.random () output range is [0, 1].
Chapter 4 Initialization and Cleaning
One. To ensure the initialization of the constructor, if a Class has a constructor, Java will automatically call its constructor before the user has the ability to operate, so it will ensure that the initialization action must be carried out. two. Method Overloading 1. Distinguishing the overloaded function Since the two functions can only be distinguished from the privileges of the function name and the function, the overload function has the same function name, so each overload function must have a unique quoter column. 2. DEFAULT Construction Function 1) The default constructor is a constructor without any quotes. If the Class you develop does not have any constructor, the compiler will automatically generate a default constructor for you. 2) If you define any constructor yourself (whether there is no quota), the compiler will not generate a default constructor for you. 3) If a Class is defined, if
Class Bush {Bush (INT I) {}}
When you want to use new bush (); to generate an instance of Class, an error is generated. Since the constructor has been defined when defining the Class, the compiler will not generate a default constructor for the CLASS. When we use new bush () to generate an instance, try to call the default constructor, but there is no default constructor in the class, so it will be wrong. Such as:
Class Sundae {Sundae (INT I) {}} public class} {public static void main (string [] args) {// sundae x = new sundae (); will compile errors, unconformable functions Sundae () Sundae Y = New Sundae (1);}}
*: When defining a Class, if you define your own constructor, it is best to define a default constructor 3. Keyword this1) This is only used within the function, and the Object Reference that "evokes this function" can be obtained. 2) In the constructor, you can call other constructor in the same class through this, such as Public Class Flower {Flower (InT Petals) {} Flower (INT PETALS, STIT) {// Petals The statement that calls another constructor must be at the most positional position this (// this (ss); there is an error, because only one constructor can be called in a constructor}}}
**: 1) In the construction call another constructor, the calling action must be placed in the most start 2) Calling constructor 3 in any function outside constructor can only call one constructor in a constructor. 4. The meaning of Static cannot call the Non-Static function in the Static function (reverse feasible). Why can't we look, let's see the example below. Example 4.2.4.1 Assume that the non-static function can be called in the Static function, then (a) will be wrong. Because there is no Movie Class instance before do not produce a Movie Class instance, the Name instance is used in GetName (), obviously wrong.
class Movie {String name = ""; Movie () {} public Movie (String name) {this.name = name;} public static String getName () {return name;}} public class Test {public static void main (String [] Args) {// The following two first generated instances, then call getName () no problem // movie movie1 = new movie ("movie1"); // String name1 = Movie1.getName (); // The following one will Error // string name2 = moVie.getname (); (a)}}
three. Cleanup: Finalization and Garbage Collection 1) Your object may not be reclaimed only when the program is not in memory, the garbage collector will start the memory space that is no longer used. . The space occupied by an object may never be released, because your program may never approach the memory of the memory, and the garbage collector is completely not started to release the memory occupied by your object, those The space will only return it to the operating system when the program terminates 3) only use Finalize () only when using native method (Native Methods). four. Member Initialization 1) The variables in the function will not be automatically initialized, such as Void f () {INT i; i ;}
Compiling errors will occur because I is not initialized. 2) Class's data members will be automatically initialized, and the specific conditions are as follows (see P220 example): Basic model: Boolean: False, Char: Null (/ U00), Byte: 0, Short: 0, Int: 0, long: 0, Float: 0, Double: 0 Object (Reference): NULL1. Initialization 1) All variables will definitely complete the initialization (see P233 example) 2 in any function (even constructor) 2) When generating a class-generating object (including the Class of the Static member is loaded), first Automatically initialize the Static member variable in the Class, and then perform all initialization actions that appear in the Static data definition, and finally perform Static Block, all of which is only performed when the object is generated for the first time. 3) Automatically initialize other member variables in the class. 4) Execute all initialization actions that appear in the data definition. Such as: INT i = 1; the execution order is to automatically initialize I 0, and then execute the initialization operation at the Data Definition, initialize the Non-Static Block6) to call the constructor. example:
Class Cup {CUP (Int Marker) {System.Out.println ("CUP (" Marker ")");} void f (int market) {system.out.println ("f (" marker ") ");}} Class cups {static CUP C1 = New CUP (11); static CUP C2; CUP C3 = New CUP (33); CUP C4; {C3 = New CUP (3); C4 = New CUP (4) } Static {c1 = new CUP (1); C2 = New CUP (2);} CUPS () {system.out.println ("CUPS ()");}} public class explicitstatic}} [] Args) {system.out.println ("INSIDE main ()"); cups.c1.f (99);} static cups x = new CUPS (); static cups y = new CUPS ();} : CUP (11) CUP (1) CUP (2) CUP (33) CUP (3) CUP (4) CUPS () CUP (33) CUP (3) CUP (4) CUPS () INSIDE Main () f (99 )2. Initialization of Array 1) You cannot specify the size when defining an array. Such as int [4] IARR = {0, 1, 2, 3}; 2) The array is just an array of Reference Reference. The structural diagrams of Array and Non-Array are as follows: a) The data is stored for basic type data. Such as INT i = 5; b) For Class variables, it is stored in Reference, which points to a memory space with a CLASS instance. Such as
String s = "hello";
The variable S is stored in a Reference, which points to a memory space with a String instance. c) For basic or array, it is stored in the Reference array, and each Reference in array points to a memory space of a Class instance. Such as
Int [] IA = {10, 11, 12};
Array IA is stored in a Reference array, and each Reference in array points to a memory space of an INT instance. d) For the Class array, stored in the Reference array, each of the references in the array points to the memory space of a Class instance. Such as
String [] SA = {"Hello1", "Hello2", "Hello3"};
The array SA stores a Reference array, and each Reference in the array points to a memory instance of a String instance. 3) An array must be initialized, and an array without initialization will generate runtime errors, such as:
INT [] IARR; System.Out.Pritnln (IARR [0]); // Generate an error, because the IARR has not initialized array initialization, and the array can be initialized to the array with the following method: a) int [] IARR = {1, 1, 1, 1}; // The length of the array is the number of {} elements B) INT i = 10;
INT [] IARR = new int [i]; // The length of the array can be variables (this is not in C / C ) System.out.Println (IARR [0]); // otr [0] is an int, Automatic initialization value is 0 integer [] IARR2 = new integer [i]; system.out.println (IARR2 [0]); // otr [0] is a Reference, automatically initial NULL
I) For basic unrecognizes, New generates an array for storing data; otherwise, only the array of Reference is stored. II) New can be used to initialize basic arrays, but cannot produce basic type data of Non-Array. c) int [] narr = new int [] {1, 1, 1, 1};
Integer [] IARR2 = new integer [] {new integer (1), new integer (2)};
3. Multidimensional arrays multidimensional array can be different, such as:
Integer [] [] [] A5; A5 = new integer [3]; for (int i = 0; i Chapter 5 Hidden Realization Details One. Java Access Specifiers Java has four access rights of public, protect, friendly, private, and this four access rights are getting smaller. 1. Friendly1) There is no permissory word in a Class member or method without any permissions, then its default access is Friendly. All other classes in the same package can access Friendly members, but Classes other than Package is shaped with private. 2) For the same folder, there is no Classes that uses Package, Java will automatically first see these Classes for the Default Package that is part of the directory, which can call each other Friendly members. As the following two classes are in the two files of the same folder, although there is no introduction of Package, they are affiliated with the same default package. Class Sundae {// The following two methods default to Friendly Sundae () {} void f () {system.out.println ("sundae.f ()");} public class} c (String "); ] Args) {sundae x = new sundae (); xf ();}} 2. Public: You can call 3 in any class 3. Private: private member can only be called inside the Class of the member belonging, such as: class Sundae {private Sundae () {} // Sundae class can be called in Sundae (int i) {} static Sundae makASundae () {return new Sundae ();}} public class IceCream {public static void main (String [] Args) {// Sundae Class In the constructor, Sundae () is private, // so cannot be used to initialize // sundae x = new sundae (); sundae y = new sundae (1); // Sundae (intae) ) Is Friendly, you can call Sundae Z = Sundae.makasundae ();}} 4. Protected: While having Friendly access, it can be accessed by Subclass (of course, including sub-grandson, ie subclass). That is, it can be accessed by Classes in the same package, and can be accessed by the Protected member's Class's Subclass. two. Class Access Permissions 1. Class also has four access access access, private: 1) PUBLIC: 2) Protect, Private: In addition to itself, there is no Class to use, so Class cannot be protected or private (Except for Inner Class) 3) Friendly: Classes in the same package can use 2. How to call the constructor is declared as a Class1) Class1) Use Static Function 2) Use SingTen mode Class Soup {private Soup () {} // (1) Static function method public static Soup Makesout () {Return New Soup ();} // (2) The "singleton" Pattern: Private Static Soup Ps1 = New Soup PUBLIC STATIC SOUP Access () {RETURN PS1;} Public Void F (String MSG) {System.out.Println ("F (" MSG ")");}} public class lunch {public static void main String [] args) {// Soup priv1 = new source (); Compilation error SOUP priv2 = Soup.makesout (); Soup priv3 = SOUP.ACCESS (); priv2.f ("priv2"); priv3.f (" PRIV3 ");} Chapter 6 Repeat Classes One. Inheritance 1. When overriding a function in the Derived Class, you can only overwrite the interface in the base class, that is, the public or protected or friends function in the base class. If you try to overriding a private function, although it is compiled, it actually just adds a function to the DeriveD Class. Such as Class Cleanser {Private Void PRT () {// (b) System.out.println ("Cleanser.PRT ()");}} public class explicitstatic Extens Cleanser {public void PRT () {system.out.println (" ExplicitStatic.PRT () ");} public static void main (string [] args) {cleanser x = new explicitStatic (); x.prt (); // (a)}} Because PRT () in Cleanser is Private, it cannot be overwritten in its DeriveD Class. The PRT () in ExPlicitStatic is just a function in the ExPlicitStatic, so when trying to call the PRT () by polymorphism at (a), an error occurs. If the private at (b) is removed, the result is explicitStatic.PRT () 2. Use of Super 1) You can call the current Class's SuperClass (parent class) by keyword super. Example 6.1.1.1 Class base {base () {system.out.println ("Base ()");} public void scrub () {system.out.println ("Base.SCRUB ()");}} Class Cleanser Extends Base {Private String s = new string ("cleanser"); public void append (string a) {s = a;} public void dilute () {append ("dilute ()");} public void apply () {append ("Apply () ");} Public void scrub () {append (" scrub () ");} public void print () {system.out.println (s);} cleanser () {system.out.println (" Cleanser (): " S);} public static void testStatic () {system.out.println (" TestStatic () ");} public static void main (String [] args) {cleanser x = new cleanser (); x .dilute (); x.Apply (); x.scrub (); x.print ();}} public class explicitstatic extends cleanser {explicitStatic () {system.out.println ("explicitstatic ()");} Void Scrub () {append ("detergen.scrub ()"); super.teststatic (); super.scrub () ; // Call Cleanser.SCRUB ()} public void foam () {append ("foam ()");} public static void main (string [] args) {explicitstatic x = new explicitStatic (); x.dilute (); X.Apply (); x.scrub (); x.foam (); x.print (); system.out.println ("test base class:"); cleanser.main (args); testsTatic );}} Run results: base () cleanser (): cleanserexplicitStatic () TestStatic () Cleanser dilute () apply () detergen.scrub () Scrub () foam () Test base class: base () cleanser (): cleansercleanser Dilute () Apply () Scrub () TestStatic () 2) When you call a member in SuperClass by super, the nearest member is called. Example 6.1.1.2 Class base {protected string bases = "base"; // (a) // private string bases = "base"; base () {system.out.println ("Base ()");}}}}} class cleanser extends base { Protected string bases = "cleanser"; // (b) public string s = new string ("cleanser"); cleanser () {system.out.println ("cleanser ():" s);} cleanser (String A ) {System.out.println ("Cleanser (" a "): s =" s);}} public class explicitstatic extends cleanser {string s2 = s; string bases = super.bases; // (c) ExplicitStatic () {Super ("explicitstatic"); system.out.println ("explicitstatic (): S2 =" S2 ", BASES =" Bases "super.bases =" super.bases; Bases = "Explicitstatic"; system.out.println ("Bases =" Bases ", Super.bases =" super.bases);} public static void main (string [] args) {explicitstatic x = new explicitstatic (); } Result 1: Base () Cleanser (ExplicitStatic): s = CleanseRexPlicitStatic (): S2 = Cleanser, Bases = CLEANSER, Super.bases = CleanSerbases = ExplicitStatic, Super.bases = Cleanser exists in three classes String Bases instance. If BASES is called directly in ExPlicitStatic, the actual call is the BASES (ie (c) member) in the current class EXPLICITATIC; if Bases is called through super.bases, the nearest Bases member is closest to the current class explicitstatic. The Bases instance (ie (b)) in the Cleanser Class is as shown in the result 1. If the (b) is commented out, Bases in the base class will be called, and the result is shown in the result 2. Result 2: Base () Cleanser (ExplicitStatic): s = cleanserexplicitStatic (): S2 = Cleanser, Bases = base, super.bases = basebases = expendstatic, super.bases = base3. Base Class Initialization 2.1 When you generate Derived Class object, it will contain the Base Class sub-object (SubObject). This sub-object is exactly the same as you separately produce the Base Class object. 2.2 The constructor of the base class can be called by super (), but must be placed in the first line of the constructor and can only be applied in the constructor. 2.3 Initialization Sequence is: 1) Loading code (.class file) 2) Initialize the static member of the Class, initialize "from the inner", that is, starting from the base class. 3) Call the constructor of the base class in the constructor of the DeriveD Class. If you do not call the BASE Class constructor in the DeriveD Class constructor, the compiler calls the BASS Class's default constructor and automatically generates the corresponding call statement to generate an Base Class instance. If the constructor of the parent class is called by the super () display in the constructor of the DeriveD Class, the specified constructor is called. The call sequence of calling the constructor is "from the outside". 4) Call the constructor of Derived Class. **: When the base class does not have a DEFAULT constructor, the constructor of the Base Class must be invoked through the Super Class constructor in the constructor of the Derive Class. Example: The initialization process of the following code is: 1) Loading the ExplicitStatic code (loads the explicitStatic.class file). 2) Discover the code of the Base Class, which is the Base Class of ExplicitStatic, loads the Cleanser.class file. 3) Find the Cleanser with keyword Extends, load the Cleanser's base class code (load base.class file). 4) Initialize static members in Base Class. 5) Initialize static members in the Cleanser Class. 6) Initialize static members in the ExplicitStatic Class. If you comment on the code at (c), then the initialization work is over. 7) Assign the storage space for the ExPlicitStatic object, and initialize the storage space to 0.8) Call the Super ("ExplicitStatic") in the constructor of the ExplicitStatic Class (Explicitly call the constructor of the parent class in the constructor of the ExplicitStatic Class). Try to generate a Cleanser Class instance. 9) Distribute storage space for the Cleanser object and initializes the storage space to 0.10) Since the Cleanser Class is inherited from the Base Class, it will pass super () in the constructor of the Cleanser Class (due to the parent class. Constructor, so the DEFAULT constructor of the parent class is automatically called) Call the constructor of the parent class, trying to generate a Cleanser Class instance. 11) Generate an Base Class instance. First initialize the member variable, then call the constructor. 12) Go back to the Cleanser Class to generate an example. First initialize the member data in the Cleanser Class, and then perform the rest of the constructor Cleanser (String A). 13) Back to the ExplicitStatic Class, generate an instance. First, the member data in the ExplicitStatic Class is initialized, and then the rest of the constructor explicitStatic ("system.out.println (" ExplicitStatic () ")). Class base {static int S1 = PRT ("S1 Initialized.", 11); INT I1 = PRT ("I1 Initialized.", 12); Base () {system.out.println ("Base ()"); system .out.println ("S1 =" S1 ", I1 =" I1); DRAW (); // (d)} Void Draw () {system.out.println ("Base.DRAW: S1 =" S1 ", I1 =" I1);} Static Int PRT (String S, INT NUM) {System.out.Println (S); Return Num;}} Class Cleanser Extends Base {Static Int S2 = PRT (" S2 Initialized. ", 21); INT I2 = PRT (" I2 Initialized. ", 22); Cleanser () {System.Out.println (" Cleanser () "); System.out.Println (" S2 = " S2 ", I2 =" I2);} cleanser (string a) {// Super (); (b) System.out.Println ("Cleanser (" A ")"); system.out.println ("S2 =" S2 ", I2 =" I2);} Void Draw () {system.out.println ("Cleanser.DRAW: S2 =" S2 ", I2 =" I2);} } public class explicitstatic explicit NDS Cleanser {Static Int S3 = PRT ("S3 Initialized.", 31); INT i3 = PRT ("I3 Initialized", 31); ExplicitStatic () {Super ("ExplicitStatic"); // (a) System.out .println ("ExplicitStatic ()"); System.out.Println ("S3 =" S3 ", I3 =" i3); } Public static void main (string [] args) {explicitStatic x = new explicitstatic (); // (c)}}}}}}}}}}}}}}}}}}}}}}}}} Result: S1 INITIALIZED.S2 INITIALIZED.S3 INITIZED. // If the code at (c) comes out The output is until this, does not output the result () S1 = 11, i1 = 12cleanser.draw: S2 = 21, I2 = 0 // (D) Results I2 Initialized.cleanser (ExPlicitStatic) / / (A) Results S2 = 21, i2 = 22i3 InitializedExPlicitStatic () S3 = 31, i3 = 31 Since the DRAW () is called in the base (), I2 in the Cleanser has not been initialized, and is assigned to the Cleanser object When the storage space is initialized to 0, then I2 is 0.2.4 code and (a) in the result in the result, indicating an example of the base class of the current Class, otherwise the base class cannot be called in the Derived Class. member. When calling the Cleanser Class constructor Cleanser (String A), in Cleanser (String A) is not explicitly invoked with the Base Class constructor, the system automatically generates the statement of the Default constructor of the Base Class, such as ( b). 4. Snoving between the combination and inheritance. 1) Inheritance is a "IS-A (one)" relationship, such as the truck is one of the car; the combination is a "HAS-A" One) "relationship, such as four wheels. 2) Do you need to transform the new Class up to Base Class. 5. Access permission in inheritance The protect variable can be called by the children. If BASES in Base Class can be called by Cleanser Class and ExplicitStatic Class. Class Base {protected string bases = "base"; // private string bases = "base"; base () {system.out.println ("Base ()");}} class cleanser extends base {protected string bases = Cleanser "; public string s = new string (" cleanser "); cleanser () {system.out.println (" cleanser (): " s);} cleanser (string a) {system.out.println (" Cleanser (" A "): s = " s);}} public class explicitStatic Extends cleanser {string s2 = s; string bases = super.bases; explicitStatic () {super (" explicitstatic "); system.out. Println ("explicitStatic (): S2 =" S2 ", BASES =" Bases "Super.bases =" super.bases); Bases = "explicitstatic"; system.out.println ("BASES =" Bases ", super.bases =" super.bases);} public static void main (string [] args) {explicitstatic x = new explicitstatic ();}}: base () cleanser (exPlicitStatic): s = CleanseRexPlicitstat IC (): S2 = Cleanser, Bases = Cleanser, Super.bases = Cleanserbases = ExplicitStatic, Super.bases = Cleanser II. Keyword finAl1. Final Data 1.1 Final Data1) When the basic type is defined as final, it indicates that its data value cannot be changed. Such as Final Int i = 9; i ; // Compiling errors, the value of I cannot change 2) When the Object Reference is defined as FINAL, it cannot be changed only about Reference instead of the object itself. Such as Class value {INT i = 1;} public class explicitstatic extends cleanser {public static void main (string [] args) {factory value v = new value (); // vi = 1 v.i ; // vi = 2 / / v = new value ();}} Since V is Final, the V is not re-pointing via new value (); however, the value of the object to which V is vary (V.I ). 1.2 Blank Finals We can declare the data member as Final but do not give initial values, this is Blank Finals. But Blank Finals must only be initialized in the constructor. Public class explicitStatic {final int = 1; explicitStatic () {ib = 2; // (a) // i = 3; (b) system.out.println ("i =" i " , Ib = " ib);} public static void main (string [] args) {explicitStatic ex = new explicitstatic ();}} IB is Blank Final, so it can be initialized in a constructor. If the code at (a) is commented away, IB does not have initial values, compiling errors. And I has been initialized at the definition, and the value of the value of i is not changed, and the code compile error at (b) is not changed. **: Non-Blank Finals members cannot change their value even in the constructor. Final Methods 1) Function that is declared for Final cannot be overwritten 2) All private functions in the class will naturally be final. 3. Final Classes1) When a class is declared as FINAL, it means that it cannot be inherited, but the Class's data member is not final, which can be changed. Such as Class smallbrain {} final class dinosaur {INT i = 7; int J = i; smallbrain x = new smallbrain (); void f () {};} // Cannot inherit Final Function // Class Further Extends DINOSAUR {} Public Class ExplicitStatic {public static void main (string [] args) {dinosaur n = new dinosaur (); nf (); Ni = 40; // final class Non-final data member can be changed n.j ;}} 2 All functions in Final Class are naturally final because no one can overwrite. Chapter 7 Polymorphism One. Then reverse the transformation (Upcasting) treats an Object Reference as a "Reference to Base Type" action called upward transformation. 1. When Upcasting is called, if the DeriveD Class overrides the function, the function in the DeriveD Class is called; otherwise, the function in the base class will be called. Such as Class first {public void PRT (system.out.println ("first");}}}} class second extends first {// (a) public void prt () {system.out.println ("second");} } public class explicitstatic {public static void main (String [] args) {first n = new second (); n.prt () ;;}} The result is second. If the PRT () function in the Second Class is commented away, the first first will be output. 2. After the upward transition, you can only call the function over the BASE Class in the base class. / * Abstract class first {int i = 122; public void prt () {system.out.println ("first.i =" i);} public abstract void prt (first f);} class second extends first {public Void prt () {system.out.println ("second.i =" i);} public void prt (first i) {} public void prt (int i) {}} public class explicitstatic {public static void main String [] args) {first n = new second (); n.prt (2) ;;}} * / class first {public void prt () {system.out.println ("first");}} Extends first {// (a) public void prt () {system.out.println ("second");} public void PRT (INT i) {// (a) system.out.println ("SECOND.I = " I);}} public class explicitstatic {public static void main (string [] args) {first n = new second (); n.prt (3);}} (a) The function is just a second Class Function, so you can't pass N.PRT (3) Conduct calls. two. Abstract Class and Abstract Methods1. If ABSTRACT CLASS exists in a class, the class must also be declared as Abstract Class. 2. Abstract Class cannot be instantiated. 3. If the base class is an Abstract Class, Derived Class must implement all Abstract Methods in the base class; otherwise, Derived Class must also be declared as Abstract Class. three. Other points 1. Pure inheritance and expansion pure inherit: Only the function suggested by the base class is overwritten by Derived Class. Expansion: In addition to overwriting the Base Class function, you have also implemented your own function. Abstract class first {public abstract void f (); public abstract void g ();} // pure inheritance class second extends first {public void f ()} public void g () {}} // Expansion Class Third Extends First {Public void f () {} public void g () {} PUBLIC VOID U () {} // base class does not exist. Down transformation 1) You can only call the Base Class to be transferred to the Base Class in the down-to-turn. Class first {public void f ()} public void g () {}} class second extends first {public void f ()} public void g ()} public void u () {} public void v () {} public void v () {} public void u () {} }}} public class explicitstatic {public static void main (String [] args) {first [] x = {new first (), new second ()}; x [0] .f (); x [1] .g ( ); //! X [1] .u (); there is no function u () // ((Second) x [(SECOND) X [(SECOND) X [1]). u () }}