更多"请写出下面程序的运行结果: public class Test ex"的相关试题:
[填空题]请写出下面程序的运行结果:
public class Test extends TT
public static void main(String args[])
Test t=new Test("Tom.");
public Test(String s)
super(S);
System.out.print("How are you");
public Test( )
this("I am Jack.");
class TT
public TT( )
System.out.print("Hi!");
public TT(String s)
this( );
System.out.print("I am" +s);
结果:______。
[填空题]请写出下面程序的运行结果:
public class Test extends TT{
public static void main(String args[])(
Test t=new Test("Tom.");
}
public Test(SUing s){
super(s);
System.out.print("How are you");
}
public Test( ){
this("I am Jack.");
}
}
class TT{
public TT( ) {
System,out.print("Hi!");
}
public TT(String s){
this( );
System.out.print("I am"+s);
}
}
结果: 【15】 。
[填空题]请写出下面程序的运行结果:
public class Test extends TT{
public static void main(String args[]){
Test t=new Test("Tom.");
}
public Test(String s){
super(s);
System.out.print("How are you");
}
public Test( ){
this("I am Jack.");
}
}
class TT{
public TT( ){
System.out.print("Hi!");
}
public TT(String s){
this( );
System.out.print("I am"+s);
}
}
结果【 】。
[填空题]请写出下面程序的运行结果:
public class Test extends TT{
public static void main(String args[]){
Test t=new Test("Tom.");
}
public Test(String s){
super(S);
System.out.print("How are you");
}
public Test( ){
this("I am Jack.");
}
}
class TT{
public TT( ){
System.out.print("Hi!");
}
public TT(String s){
this( );
System.out.print("I am" +s);
}
}
结果:______。
[简答题]阅读下面程序
1 public class Try extends Thread
2 public static void main(String args[])
3 Try t=new Try( );
4 t.start( );
5
6
7 public void run(int j)
8 int i=0;
9 while(i<5)
10 System.out.println("祝你成功!");
11 i++:
12
13
14
该程序若能打印5行“祝你成功!”,必须改正程序中的某行代码,选择正确的修改是
[单项选择]下面程序段的输出结果是______。
public class Test
public static void main(String args[ ])
int[ ]a=new int[11];
int[ ]p=new int[4];
int k=5;
for(int i=1;i<=10;i++)
a[i]=i;
for(int i=1;i<=3;i++)
p[i]=a[i*i];
for(int i=1;i<=3;i++)
k=k+p[i]*2;
System.out.println(k);
A. 37
B. 31
C. 33
D. 35
[单项选择]执行下列程序段之后,变量n的值为( )。
public class Test
public static void main(String[ ] args)
int y = 2;
int z = 3;
int n = 4;
n=n+-y* z/n;
System. out. println(n);
A. 3
B. -1
C. -12
D. -3
[单项选择]执行下列程序段之后,变量b的值为( )。
public class Test
public static void main (String[] args)
int i = 12;
int j = 24;
boolean b1 = true;
booleanb=(j%i==0)&&(! b1) || (j/i! =2);
System. out. println (b);
A. true
B. false
C. 0
D. 1
[单项选择]阅读下面程序
1public class Try extends Thread 2public static void main(String args[])
3Tryt=new Try( );
4t.start( );
5
6
7publicvoidrun(intj)
8inti=0;
9while(i<5)
10System.out.println("祝你成功!");
11 i++;
12
13
14
该程序要求打印5行“祝你成功!”,必须改正程序中的某行代码,程序才能完成。选择正确的修改是( )。
A. 将第1行的extendsThread改为implementsRunnable
B. 将第3行的newTry()改为newThread()
C. 将第4行t.start()改为start(t)
D. 将第7行的publicvoidmn(intj)改为publicVoidmn()
[单项选择]阅读下面程序
1 public class Try extends Thread{
2 public static void main(String args[]){
3 Try t=new Try( );
4 t.start( );
5 }
6
7 public void run(int j){
8 int i=0;
9 while(i<5){
10 System.out.println(“祝你成功!”);
11 i++;
12 }
13 }
14 }
该程序要求打印5行“祝你成功!”,必须改正程序中的某行代码,程序才能完成。选择正确的修改是【 】
A. 将第1行的extendsThread改为implementsRunnable
B. 将第3行的newTry()改为newThread()
C. 将第4行t.start()改为start(t)
D. 将第7行的publicvoidrun(intj)改为publicvoidrun()