更多"阅读下面程序 class Test implements Runna"的相关试题:
[单项选择]阅读下面程序
class Test implements Runnable
public static void main (String[] args)
Test t=new Test( );
t.start( );
public void run( )
下列关于上述程序的叙述正确的是______。
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start( ); } public void run( ) { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
A. Test t=new Test();
B. Thread t=new Thread();
C. Thread t=new Thread(new Test());
D. Test t=new Thread();
[单项选择]阅读下面代码
class Test implements Runnable
public int run( )
int i=0;
while(true)
i++;
System.out.println("i="+i);
上述代码的编译结果是
A. 程序通过编译,并且run()方法可以正常输出递增的i值
B. 程序通过编译,调用run()方法将不显示任何输出
C. 程序不能通过编译,因为while的循环控制条件不能为true
D. 程序不能通过编译,因为run()方法的返回值类型不是void
[单项选择]
阅读下面程序
class Test implements Runnable {
public static void main(String[] args) {
Test t = new Test( );
t.startO;
}
public void run( ){ }
}
下列关于上述程序的叙述正确的是()
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]阅读下面代码 public class Test implements Runnable { public void run(Thread t) { System.out.println("Running"); } public static void main(String[] args) { Thread tt=new Thread(new Test( )); tt.start( ); } } 代码运行的结果是
A. 将抛出一个异常
B. 没有输出并正常结束
C. 输出“Running”并正常结束
D. 程序第2行将出现一个编译错误
[单项选择]阅读下列代码段。
class Test implements Runnable
public int run( )
int i=0;
while(true)
i++;
System.out.println('i='+i);
上述代码的编译结果是( )。
A. 程序通过编译并且run()方法可以正常输出递增的i值
B. 程序通过编译,调用run()方法将不显示任何输出
C. 程序不能通过编译,因为while的循环控制条件不能为“true”
D. 程序不能通过编译,因为run()方法的返回值类型不是void
[单项选择]阅读下面程序
public class Test2
public static void main (String args[])
int a=10, b=4, C=20, d=6;
System.out .printIn(a++*b+c*--d);
程序运行的结果是______。
A. 144
B. 160
C. 140
D. 164
[单项选择]阅读下面程序
public class Test4
public static void main(String[] args)
int 1=10,j=3;
float m=213.5f,n=4.0f;
System.out.println(i%j);
System.out.println(m%n);
程序运行的结果是
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]阅读下面程序
public class Test3
public static void main(String[] args)
int x=3,y=4,z=5;
String s="xyz":
System.out.println(s+x+y+z);
程序运行的结果是
A. xyz12
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]
阅读下面程序
public class Test4 {
public static Void main(String args[]){
int i=10, j=3;
float m=213.5f, n=4.0f;
System.out.println(i%j);
System.out.println(m%n);
}
}
程序运行的结果是()
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]
阅读下面程序
public class Test3 {
public static void main(String args[]){
int x=3, y=4, z=5;
String s="xyz";
System.out.primln(s+x+y+z);
}
}
程序运行的结果是()
A. xyzl2
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]阅读下面程序 public class Test2 { public static void main(String args[]){ int a=1O, b=4, c=20, d=6; System.out.println(a++*b+c*--D) ; } } 程序运行的结果是
A. 144
B. 160
C. 140
D. 164
[单项选择]
阅读下面程序
public class Test1 {
public static void main(String[] args){
System.out.println(34+56-6);
System.out.println(26*2-3);
System.out.println(3*4/2);
System.out.println(5/2);
}
}
程序运行结果是()
A. 84 49 6 2
B. 90 25 6 2.5
C. 84 23 12 2
D. 68 49 14 2.5
[单项选择]阅读下面程序 public class Test2 ______ { public static void main(String[] args) { Thread t=new Test2( ); t.start( ); } public void run( ) { System.out.println("How are you."); } } 程序中下画线处应填入的正确选项是
A. implements Thread
B. extends Runnable
C. implements Runnable
D. extends Thread
[单项选择]阅读下列程序:
public class Test
public static void main (String args[])
int x=3;
for (int i=1;i<=10; i++) x=x+i/4;
System. out. println(x);
程序的输出结果是( )。
A. 12
B. 13
C. 14
D. 15
[单项选择]阅读下面代码
public class Test
public static void main(String[]args)
System.out.println(2>010:8);
其运行的结果是
A. 2
B. 0
C. 10
D. 8
[单项选择]阅读下面代码 public class Test { public static void main(String[]args) { System.out.println(2>010:8); } } 其运行的结果是
A. 2
B. 0
C. 10
D. 8