单项选择题
下列代码的执行结果是( )。 public class Test{ public int aMethod( ) { static int i=0; i+ +; System.out.println(i); } public static void main(String args[ ]){ Test test = new Test( ); test.aMethod( ); } }
A.构造方法名必须与类名一致
B.构造方法是给对象赋初值,所以没有返回值,且不用void来声明
C.构造方法一般不能由编程人员显示地直接调用,而是用new来调用
D.构造方法不可以被重载
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下列程序的输出结果是( )。class Father{int m.n;Father(int a,int B) { m=a;n=b}void show ( ){System.out.println( m and n: +m+ +n);}}class Son extends Father{int p;Son (int a,int b,int C) { super(a,B) ;p=c;}void show(){supur.show( );System.out.println( p: +p);}}class Test {public static void main (String args[ ]){ Son s:new Son(6,7,8); s.show( );}}
A. True
B. False
C.-1
D.1
点击查看答案&解析
单项选择题
树是结点的集合,它的根结点数目是( )。
A.有且只有1个
B.1或多于1个
C.0或1个
D.至少2个
点击查看答案&解析
相关试题
下列程序执行后,k的值是( )。public c...