1. Interface: an interface is a special class, which is composed of a global constant (static final) and a public abstract method (abstract. [Java] interface A {// define interface A public static final String AUTHOR = "Li Xinghua"; // global constant public abstract void print (); // abstract method public abstract String getInfo (); // abstract method} can be simplified during development: [java] view plaincopyinterface A {// define interface A String AUTHOR = "Li Xinghua"; // global constant void print (); // abstract method String getInfo (); // abstract method} the first two methods are the same. 2. Implementation interface: [java] interface A {// defines interface A public String AUTHOR = "Li Xinghua"; // global constant public void print (); // abstract method public String getInfo (); // abstract method} interface B {// define interface B public void say (); // define abstract method} class X implements, class B {// Class X implements both the public void say () {System. out. println ("Hello World !!! ");} Public String getInfo () {return" HELLO ";} public void print () {System. out. println ("AUTHOR:" + AUTHOR) ;}}; public class InterfaceDemo03 {public static void main (String args []) {X x X = new X (); // instantiate the subclass object x. say (); x. print () ;}; 3. inherit the abstract class implementation interface: [java] interface A {// define interface A public String AUTHOR = "Li Xinghua "; // global constant public void print (); // abstract method public String getInfo (); // abstract method} abstract class B {// Define abstract class B public abstract void say (); // define abstract method} class X extends B implements A {// class X inherits class B, then implement the public void say () {System. out. println ("Hello World !!! ");} Public String getInfo () {return" HELLO ";} public void print () {System. out. println ("AUTHOR:" + AUTHOR) ;}}; public class InterfaceDemo04 {public static void main (String args []) {X x X = new X (); // instantiate the subclass object x. say (); x. print () ;}; [java] view plaincopyinterface A {// define interface A public String AUTHOR = "Li Xinghua"; // global constant public void print (); // abstract method public String getInfo (); // abstract method} abstract class B implements A {// define abstract class B and implement interface A public abstract void say (); // define abstract method} class X extends B {// class X inherits class B public void say () {System. out. println ("Hello World !!! ");} Public String getInfo () {return" HELLO ";} public void print () {System. out. println ("AUTHOR:" + AUTHOR) ;}}; public class InterfaceDemo05 {public static void main (String args []) {X x X = new X (); // instantiate the subclass object x. say (); x. print () ;}; 4. interface inheritance: [java] interface A {// define interface A public String AUTHOR = "Li Xinghua "; // global constant public void printA (); // abstract method} interface B {public void printB ();} interface C ext Ends A, B {public void printC ();} class X implements C {// class X inherits class B public void printA () {System. out. println ("A, Hello World !!! ");} Public void printB () {System. out. println ("B, Hello MLDN");} public void printC () {System. out. println ("C, Hello LXH") ;}}; public class InterfaceDemo06 {public static void main (String args []) {X x X = new X (); // instantiate the subclass object x. printA (); x. printB (); x. printC () ;}; 5. Summary