更多"阅读下面程序 1 public class Try extends"的相关试题:
[单项选择]阅读下面程序
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[]){
3Try t=new Try( );
4 t.start( );
5}
6
7 public void run(intj){
8 inti=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行的public void run(intj)改为public void run()
[简答题]阅读下面程序
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行“祝你成功!”,必须改正程序中的某行代码,选择正确的修改是
[单项选择]阅读下面程序
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.printIn("祝你成功!");
11 i++;
12
13
14
该程序要求打印5行"祝你成功!",必须改正程序中的某行代码,程序才能完成,选择正确的修改是______。
A. 将第1行的extends Thread改为implements Runnable
B. 将第3行的new Try()改为new Thread()
C. 将第4行的t.start()改为start(t)
D. 将第7行的public void run(int j)改为public void run()
[单项选择]阅读下面程序 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行的extends Thread改为implements Runnable
B. 将第3行的new Try()改为new Thread()
C. 将第4行的t.start()改为start(t)
D. 将第7行的public void run(int j)改为public void run()
[填空题]请写出下面程序的运行结果:
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);
结果: 【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);
}
}
结果: 【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 Increment {
public static void main( String args[] ){
int c;
c=5;
System.out.println(C) ;
System.out.println(c++);
System.out.println(C) ;
}
}
输出结果是【 】
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]阅读下面程序
public class OperatorsAndExpressions{
void equalsMethodl( ){
String s1=new String("how are you");
String s2=new String("how are you");
System.out.println(s1==s2);
}
public static void main(String args[]){
OperatorsAndExpressionsOperAndExp=new OperatorsAndExpressions( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethod1( );
}
}
程序运行结果是【 】
A. =
B. TRUE
C. FALSE
D. equal
[单项选择]阅读下面程序
public class OperatorsAndExpressions
void equalsMethodl( )
String s1=new String("how are you");
String s2=new String("how are you");
System.out.println(s1==s2);
public static void main(String args[])
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethodl( );
程序运行的结果是
A. ==
B. true
C. false
D. equal