请看下列代码:public interface A {String DEFAULT_GREETING = “Hello World”;public void method1();}现有接口B,是A接口的子接口,下列选择中B接口的声明正确的是:
A: public interface B extends A { }
B: public interface B implements A {}
C: public interface B instanceOf A {}
D: public interface B inheritsFrom A { }
A: public interface B extends A { }
B: public interface B implements A {}
C: public interface B instanceOf A {}
D: public interface B inheritsFrom A { }
举一反三
- 请看下列代码public interface A {String default Green= "helloworld";public void method();}现有接口B,是A接品的子接口,下列选择中B接品的声明正确的是() A: public interface B extends A{} B: public interface B implements A{} C: public interface B instanceOf A{}
- 下列关于接口的定义哪项是正确的? A. interface C{int a;) B. public interface A implements B {) C. public interface A {int a(); ) D. abstract interface D {) A: interface C{int a;} B: public interface A implements B {} C: public interface A {int a(); } D: abstract interface D {}
- 接口是一种规范和标准,它可以约束类的行为。下列接口定义正确的是 。 A: public interface IBicycle { public void ride(); } B: public interface IBicycle { void ride(); } C: public interface IBicycle { String Type { Get(); Set(); } } D: interface IBicycle { string color; }
- 想要定义一个接口ServerImg,下列语句哪一项是正确的( ) A: public class ServerImg{} B: public interface ServerImg{} C: public class ServerImg(){} D: public interface ServerImg(){}
- A类同时实现接口B和接口C,正确的写法是: A: public class A implements B, implements C {...} B: public class A implements B, C {...} C: public class A interface B, iinterface C {...} D: public class A extends B, C {...}