有一段程序代码如下,以下哪个选项中的语句是正确的。 public interface A { } public class B implements A { } public class C extends B { }
举一反三
- 给定代码如下: public abstract interface Frobnicate { public void twiddle(String s); } 以下哪个类是正确的?(). A: public abstract class Frob implements Frobnicate { public abstract void twiddle(String s) { } } B: public abstract class Frob implements Frobnicate { } C: public class Frob extends Frobnicate { public void twiddle(Integer i) { } } D: public class Frob implements Frobnicate { public void twiddle(Integer i) { } }
- 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; )
- 假设C和D是接口,下列定义哪个是正确的() A: public class A implements C,D{ } B: public class A implements C implements D{ } C: public class A extends C,D{ } D: public class A extends C extends D{ }
- 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 {...}
- 下面哪些语法结构是不正确的( ) A: public class A extends B implements C B: public class A implement A B C: public class A implements B,C,D D: public class A implements B