编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void printCapitalLetter();在接口InterfaceB中有个方法void prin

Posted 凌零聆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void printCapitalLetter();在接口InterfaceB中有个方法void prin相关的知识,希望对你有一定的参考价值。

package lianxi;

public interface InterfaceA {
    void printCapitalLetter();


}
package lianxi;

public interface InterfaceB {
    void printLowercaseLetter();
}
package lianxi;

public class Print1 implements InterfaceA, InterfaceB {

    @Override
    public void printLowercaseLetter() {
        for (int i = 97; i < 123; i++) {
            System.out.print((char)i);
            
            
        }
           System.out.println();
    }

    @Override
    public void printCapitalLetter() {
        for (int i =65; i < 91; i++) {
            System.out.print((char)i);
            
        }
           System.out.println();
    }

}
package lianxi;

public class E {

public static void main(String[] args) {

     InterfaceA a=new Print1();
     InterfaceB b=new Print1();
     a.printCapitalLetter();
     b.printLowercaseLetter();
    
    
}
    

}

以上是关于编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void printCapitalLetter();在接口InterfaceB中有个方法void prin的主要内容,如果未能解决你的问题,请参考以下文章

编写2个接口:InterfaceA和InterfaceB;在接口InterfaceA中有个方法void printCapitalLetter();在接口InterfaceB中有个方法void prin

java基础练习编写2个接口

接口1

Java-接口练习

java 基础--接口

接口(字母大小写)