请看下列代码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: public interface B extends A{}
B: public interface B implements A{}
C: public interface B instanceOf A{}
举一反三
- 请看下列代码: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. 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; }
- Which two demonstrate an “is a” relationship? () A: public interface Person{} public class Employee extends Person{} B: public interface Shape{} public class Employee extends Shape{} C: public interface Color{} public class Employee extends Color{} D: public class Species{} public class Animal (private Species species;) E: interface Component{} Class Container implements Component ( Private Component[ ] children; )
- 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 {...}