编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void
printCapitalLetter();在接口InterfaceB中有个方法void printLowercaseLetter();然
后写一个类Print实现接口InterfaceA和InterfaceB,要求printCapitalLetter()方法
实现输出大写英文字母表的功能,printLowercaseLetter()方法实现输出小写英文
字母表的功能。再写一个主类E,在主类E的main方法中创建Print的对象并赋
值给InterfaceA的变量a,对象a调用printCapitalLetter方法;最后再在主类E
的main方法中创建Print的对象并赋值给InterfaceB的变量b,对象b调用
printLowercaseLetter方法。
package zuoye0923;
public interface InterfaceA {
void
printCapitalLetter();
}
package zuoye0923;
public interface InterfaceB {
void printLowercaseLetter();
}
package zuoye0923;
//实现接口InterfaceA, InterfaceB
public class Prin implements InterfaceA, InterfaceB {
@Override
public void printLowercaseLetter() //实现小写
{
String xiao="abcdefghijklmnopqrstuvwxyz";
System.out.println(xiao);
}
@Override
public void printCapitalLetter() //实现大写
{
String da="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
System.out.println(da);
}
}
package zuoye0923;
public class E {
//测试
public static void main(String[] args) {
Prin x=new Prin();
InterfaceA a=new Prin();
a.printCapitalLetter();
InterfaceB b=new Prin();
b.printLowercaseLetter();
}
}