四、 简答题 (共6题,30分)
1、写出下列程序的运行结果____01234_____
public class X3_3_1 {
public static void main(String[] args) {
for(int i=0; i
10 )}
public static void main(String arg[])
{
int i=10;
Test t= new Test();
t.printValue(i);
}
}
(5.0)
正确答案: The value is10
5、写出下列代码执行后的输出结果_______。
int a=19,b=8;
int x=(a%b>5)? a+b:a-b;
System.out.println(x);
(5.0)
正确答案: 11
6、请在下方插入处插入合适的代码:________________
public class T{
int r;
int s;
T(int x,int y){
r=x;
s=y;
}
}
class S extends T{ int t;
public S(int x,int y,int z){ //插入代码处:要求插入代码实现 r=x,s=y
t=z;
}
}
(5.0)
正确答案: super(x,y);