Interface interface in Java is a special class that consists of global constants and common abstract methods (without the need for an abstract declaration).
Subclasses can implement multiple interfaces at the same time, in the following format:
Interface Aa{public String AUTHOR = "aituming";p ublic void print ();p ublic string GetInfo ();} Interface bb{public void Say ();} Class X implements AA, Bb{public Void Say () {System.out.println ("Hello!!!");} Public String GetInfo () {return "HELLO";} public void print () {System.out.println ("" + AUTHOR);}} public class InterfaceDemo01 {public static void main (string[] args) {//TODO auto-generated method STUBX x = new X (); x.pr int (); X.say ();}}
You can use an abstract class to inherit multiple interfaces, and an interface can inherit multiple interfaces, but an interface cannot inherit an abstract class.
Interfaces in Java