Third, the type, polymorphic, abstract classes, three interfaces, classes, polymorphism, abstract classes, interfaces

Third, the type, polymorphic, abstract classes, interfaces

 

Block:
  a partial code block:
  execution method and structure together, and a method performed prior to construction, once executed once every new: code blocks configured
  static block of code: class loading and together, and performs only once

 

Data inherit the parent class subclasses in all subclasses will be initialized before the parent class initialization

 

All constructors in the subclass inherits the default parent class will be empty argument constructor super ()

 

A: The overridden method Notes
* a: the parent class private methods can not be overridden
* because the parent class private methods simply can not subclass inherits
* b: When overriding subclass the parent class method, access rights can not be less
* most well it is the same
* c: static methods parent class, subclass must be rewritten by the static method
* in fact, this method is not really rewrite, but the phenomenon is indeed the case, as to why not really overridden methods, polymorphism I will explain (static only cover static)

 

If no parent class constructor with no arguments:

  1, super (parameters) have access to the parent class reference
  2, this (parameters) have access to the class parent class has access to reference parameters

 

 

Polymorphic: polymorphic
  static method
    * Compile look to the left (parent), run to the left to see the (parent).
  Member method of compiling look left, look right of the run (subclass)

 

Abstract class abstract class

  There can be a constant member variables can also be a variable

  There constructor for the subclass to initialize


  Abstract class method is not necessarily certain abstract abstract method in an abstract class or interface

   If an abstract class without abstract methods, can you define an abstract class and if so, what is the point??
    Can not let this other class creates a class object, but let subclasses to complete the

  abstract and the keywords can not coexist
    static: class Point name call meaningless
    final: final can not override
    private: it can not be inherited

  

Interface interface implement 

  Member variables can only be a constant

  No constructor

Block:
  a partial code block:
  execution method and structure together, and a method performed prior to construction, once executed once every new: code blocks configured
  static block of code: class loading and together, and performs only once

 

Data inherit the parent class subclasses in all subclasses will be initialized before the parent class initialization

 

All constructors in the subclass inherits the default parent class will be empty argument constructor super ()

 

A: The overridden method Notes
* a: the parent class private methods can not be overridden
* because the parent class private methods simply can not subclass inherits
* b: When overriding subclass the parent class method, access rights can not be less
* most well it is the same
* c: static methods parent class, subclass must be rewritten by the static method
* in fact, this method is not really rewrite, but the phenomenon is indeed the case, as to why not really overridden methods, polymorphism I will explain (static only cover static)

 

If no parent class constructor with no arguments:

  1, super (parameters) have access to the parent class reference
  2, this (parameters) have access to the class parent class has access to reference parameters

 

 

Polymorphic: polymorphic
  static method
    * Compile look to the left (parent), run to the left to see the (parent).
  Member method of compiling look left, look right of the run (subclass)

 

Abstract class abstract class

  There can be a constant member variables can also be a variable

  There constructor for the subclass to initialize


  Abstract class method is not necessarily certain abstract abstract method in an abstract class or interface

   If an abstract class without abstract methods, can you define an abstract class and if so, what is the point??
    Can not let this other class creates a class object, but let subclasses to complete the

  abstract and the keywords can not coexist
    static: class Point name call meaningless
    final: final can not override
    private: it can not be inherited

  

Interface interface implement 

  Member variables can only be a constant

  No constructor

Guess you like

Origin www.cnblogs.com/yaobiluo/p/11301977.html