Write 2 interfaces: Interfacea and INTERFACEB; there is a method void in the interface interfacea
Printcapitalletter (); In interface Interfaceb there is a method void Printlowercaseletter ();
After writing a class print implementation interface Interfacea and INTERFACEB, requires the Printcapitalletter () method
Implements the output capital English alphabet function, the Printlowercaseletter () method implements the output lowercase English
The function of the alphabet. Write a main class E, create the Print object in the main method of the primary class E, and assign
The value given to Interfacea is variable A, object A calls the Printcapitalletter method, and finally in the main class E
The Main method creates a print object and assigns a value to the variable B of INTERFACEB, which is called by object B
Printlowercaseletter method.
Package com.chuoji.text01; Public Interface interfacea { void printcapitalletter (); }
Package com.chuoji.text01; Public Interface interfaceb { void printlowercaseletter (); }
Package com.chuoji.text01; Public classPrint implements Interfacea, Interfaceb {@Override Public voidPrintlowercaseletter () {System. out. println ("abcdefghijklmnopqistuvwxyz"); } @Override Public voidPrintcapitalletter () {System. out. println ("ascdefghijklmnopqrstuvwxyz"); }}
Package com.chuoji.text01; Public class E { publicstaticvoid main (string[] args) { interfacea a= New Print (); Interfaceb b=new Print (); B.printlowercaseletter (); A.printcapitalletter (); }}
Java Basic Interface Exercises