Interfaces, polymorphism, static constants

   

interface

Interface is a function of the combination of

Originally abstract class which can have a general category, but there can be only abstract interface class class

Subclass interface is implementation class,

Interface Demonstration:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Java support does not support multiple inheritance? No, only single inheritance, but can have more to achieve!

Interface can be multiple inheritance, but the interface is inherited only

First inheritance, after realization

Implementation class can not be multi-skilled, multi-only single inheritance but can achieve,

 

 

 

 

Interface methods in the abstract whether you write do not write modifiers are the default *

 

 

 

 

 

 

Static const

 

 

 

Features: You can use the class name to call

Polymorphism

 

 

Instanceof Keywords:

 

 

Inheritance system have to see Fu f = new Zi ();

 

 

 

Polymorphism can not be called a subclass specific method, after the transition is determined only down calls, if needed to use keywords to add Instanceof judge;

 

 

 

 

 

 

         Packaging: The implementation details of the object properties and methods of concealment, only provide external access to some public way

         Inheritance: subclasses will automatically have all the properties and methods of the parent class inheritable.

         Polymorphism: with inherited and overridden methods to improve the scalability and reusability of code; if not overridden methods, the same polymorphism does not make sense.

Guess you like

Origin www.cnblogs.com/pandam/p/10960184.html