单选题
Java
题号 #2592039
下列代码中,将引起-个编译错误的行是( )。

参考答案
D
答案解析
本题考查考生对Java中构造方法的理解及应用。构造方法名必须与类名相同,没有返回值,用户不能直接调用,只能通过new自动调用。题目有两个构造方法Test( )和Test(int a),按照参数决定调用哪个方法。tl=newTest( )语句调用Test( )方法,而t2=newTest(j,k)将会找不到相应的构造方法,程序编译出错在第10行,所以选项D正确。
你可能感兴趣的试题
A.sleep(1000)
B.t. sleep(1000)
InterruptedExceptionInterruptedException
InterruptedExceptionInterruptedException
C.Thread. sleep(1000)
D.Thread. sleep(1000)
RuntimeExceptionlnterruptedException
RuntimeExceptionlnterruptedException


