以下选项可替换题目中的//1而不产生编译错误的是( )。 public abstract class MyClass{ public int constInt = 5; //1 public void method(){ } }
A: public abstract void method(int a);
B: constInt = constInt + 5;
C: public int method();
D: public abstract void anotherMethod();
A: public abstract void method(int a);
B: constInt = constInt + 5;
C: public int method();
D: public abstract void anotherMethod();
举一反三
- 补全以下程序代码public abstract class MyClass { public int constInt = 5; 请在此处补全代码 public void method() { }} A: public abstract void method(int a); B: constInt = constInt + 5; C: public int method(); D: public abstract void anotherMethod() {}
- 选项中哪一行代码可以替换题目中//add code here而不产生编译错误?() A: public abstract void method(int a); B: constInt = constInt + 5; C: public int method(); D: public abstract void anotherMethod() {}
- 下面选项中哪一行代码可以替换题目中注释语句//add code here不会产生编译错误?()请解释原因?publicabstractclassMyClass {publicintconstInt = 5;//add code herepublicvoidmethod() {}} A: public abstract void method(int a); B: constInt = constInt + 5; C: public int method(); D: public abstract void anotherMethod() {}
- 智慧职教: 选项中哪一行代码可以替换题目中//add code here而不产生编译错误?()public abstract class MyClass { public int constInt = 5; //add code here public void method() { } }
- 把方法声明为抽象的公共方法是()? A: public abstract method(); B: public abstract void method(); C: public abstract void method(){} D: public void method()extends abstract