There is an interface in the software, and there is a big difference between the interface and the interface in the hardware.
Here the interface does not consider the new features of JDK8 (JDK8 start interface can have non-abstract methods, introduced JDK8 new features may have to complete the first season to finish! )
or directly into the interface of learning:
/* Interface Features: A: interface with keyword interface means interface interface Name {}b: Class (Implementation) interface with implements (execution, implementation) represents class class name implements interface name {}c: interface cannot be instantiated, Which means you can't create an object out of thin air. So, how does an interface instantiate? To instantiate in a polymorphic manner. An analogy polymorphic way of instantiating D: a subclass of an interface A: can be an abstract class. But it doesn't make much sense. B: Can be a specific class. To override all abstract methods in an interface. (recommended scheme) *///Definition Animal Training Interface interface Animaltrain {public abstract void jump (); Abstract class implements interfaces, meaningless abstract class Dog implements Animaltrain {}//Concrete class implements interfaces, implements special things. Interface Implementation class Cat implements Animaltrain {// Class name implements interface name {}public void jump () {System.out.println ("The Cat Can Leap");}} Class Interfacedemo {public static void main (string[] args) {//animaltrain interface is abstract; cannot instantiate//animaltrain at = new Animaltrain ( );//at.jump ();//Instantiate the interface in a polymorphic manner. Cat at = new Cat ();//Own Class at.jump (); Animaltrain a = new Cat ();//polymorphic A.jump ();}}
/* Classes and classes: Inheritance relationships, can only be single-inheritance, multi-tier inheritance. Classes and interfaces: implementation relationships can be implemented either single or multiple. class Son extends Object implements Father,mother {} and can also implement multiple interfaces while inheriting a class. For example: Class Son (extends Student) implements Father,mother {} interface and interface: An inheritance relationship that can be either single-inherited or multiple-inherited. */interface Father {public abstract void show (); Interface Mother {public abstract void Show2 ();} Interface Sister extends Father,mother {}//class Son implements Father,mother//Multiple implementations class Son extends Object implements Fat The her,mother {public void Show () {//implementation relationship can be implemented either single or multiple. System.out.println ("show Son"); public void Show2 () {System.out.println ("show2 Son");}} Class InterfaceDemo3 {public static void main (string[] args) {//create object Father f = new Son (); F.show ();//f.show2 ();//Error, Father The interface does not show () 2 so the error to be used can be transformed by mother M = new Son ();//m.show (); The cause of the error is m.show2 ();}}
The object-oriented (talk about interfaces) of the first season of Java entry