如下A类的定义中,不可以使用new A( )创建对象的是
A: public class A { int x; double d; }
B: public class A { int x; double d; public A(){
} }
C: public class A { int x; double d; public A(){ x = 1; d = 0.5; } }
D: public class A { int x; double d; public A(int x,double d){ this.x = x;
this.d = d; } }
E: public class A { int x; double d; public A(int x,double d){ this.x = x;
this.d = d; } public A( ){
} }
A: public class A { int x; double d; }
B: public class A { int x; double d; public A(){
} }
C: public class A { int x; double d; public A(){ x = 1; d = 0.5; } }
D: public class A { int x; double d; public A(int x,double d){ this.x = x;
this.d = d; } }
E: public class A { int x; double d; public A(int x,double d){ this.x = x;
this.d = d; } public A( ){
} }
举一反三
- 下列方法定义中,方法头不正确的是( ) A: public int x( ){ ... } B: public static int x( double y ){ ... } C: void x( double D: { ... } <br> <br>public static x( double a ){ ... }
- 不能与该方法构成重载的方法是() public double fun(int x,double y){ return x + y; } A: public void fun(int x){ System.out.println("x * x="+(x*x)); } B: public void fun(int a, double b){ System.out.println("a +b ="+(a+b)); } C: public int fun(int x, int y,int z){ renturn (x+y+z); } D: public double fun(double x, int y){ return x * y ; }
- 下列方法定义中,方法头不正确的是( )。 A: public int x( ){ ... } B: public static int x( double y ){ ... } C: void x( double d ) { ... } D: public static x( double a ){ ... }
- 【单选题】下列方法定义中,方法头不正确的是() A: public static x(double a) B: public static int x(double y) C: void x(double d) D: public int x()
- 以下的类(接口)定义中正确的是( ) A: public class A{ private int x; public getX(){ return x; }} B: public abstract class A{ private int x; public abstract int getX(); public int aMethod(){ return 0; }} C: public class A{ private int x; public abstract int getX();} D: public interface interfaceA{ private int x; public int getX(){ return x; }}