题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-01-19 18:09:56

[单项选择]阅读下列程序:
Public class Test implements Runnable
Private int x=0;
Private int y=o;
boolean flag=true;
Public static void main(string[]args)
Test r=new Test( );
Thead t1=new Thead(r);
Thead t2=new Thead(r);
t1. start( );
t2. start( );

Public void run( )
While(flag)
x++;
y++;
system. out. println("("+x_", "+y+")");
if(x>=10)
flag=false;



下列对程序运行结果描述的选项中,正确的是______。
A. 每行的(x,y)中,可能有x≠y;每一对(x,y)值都出现两次
B. 每行的(x,y)中,可能有x≠y;每一对(x,y)值仅出现一次
C. 每行的(x,y)中,可能有x=y;每一对(x,y)值都出现两次
D. 每行的(x,y)中,可能有x=y;每一对(x,y)值都出现一次

更多"阅读下列程序: Public class Test implemen"的相关试题:

[单项选择]阅读下面程序
public class Test implements Runnable
 private int x=0;
 private int y=0;
 boolean flag=true;
 public static void main(String[]args)
  Test r=new Test( );
  Thread t1=new Thread(r);
  Thread t2=new Thread(r);
  t1.start( );
  t2.start( );
 
 public void run( )
  while(flag)
  x++;y++;
   System.out.println("("+x+","+y+")");
  if(x >=10) flag=false;
  
 

下列对程序运行结果描述的选项中,正确的是
A. 每行的(x,y)中,可能有x≠Y;每一对(x,y)值都出现两次
B. 每行的(x,y)中,可能有x≠y;每一对(x,y)值仅出现一次
C. 每行的(x,y)中,x=y;每一对(x,y)值都出现两次
D. 每行的(x,y)中,x=y;每一对(x,y)值都出现一次
[填空题]请阅读下面程序
public class Test
public static void main (String[] args)
int i,j;
for (i=1;i<5;i++)
for (j=1;j<=i;j++)
system.out.print (i+"X"+j+"="+i*j+" ");
System.out.println( );



程序执行完后,i循环和j循环执行的次数分别是 【12】
[单项选择]阅读下面程序
public class Test4
public static void main (String args[])
int i=10, j=3;
float m=213.5f,n=4.0f
System.out.printIn (i%j);
System.out.printIn (m%n);


程序运行的结果是______。
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]阅读下面程序
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
B. 90
C. 84
D. 68
[填空题]请阅读下面程序 public class Test { public static void main (String[] args) { int i,j; for (i=1;i<5;i++) { for (j=1;j<=i;j++) system.out.print (i+"X"+j+"="+i*j+" "); System.out.println( ); } } } 程序执行完后,i循环和j循环执行的次数分别是 【12】
[单项选择]下列程序的执行结果是______。
class T5 implements Runnable

public void run( )

int i = 0;
While(i<2)

Thread t = Thread.currentThread( );
System.out.println(i + t.getName( ));
i++



public class Testl6

public static void main(String[] args)

Thread t1 = new Thread(new T5( ), "TS");
t1.start ( );
Thread t = Thread.currentThread( );
for(int i = 0; i<3; i++)

System.out.println(I + t.getName( ));
if(i == 1 && t1.isAlive( ))
t.yield( );



A. Omain
B. Omain
C. Omain
D. Omain
[单项选择]下列程序的执行结果是______。 class A1 implements Runnable { public void run( ) { for(iht i = 0; i < 10; i++) { System.out.println("i =" + i); if(i == 3) break; } } } public class ex38 { public static void main(String[] args) { Thread th1 = new Thread(new A1( )); th1.start ( ); } }
A. i=1 i=2 i=3 i=4
B. i=1 i=1 i=1 i=1
C. i=0 i=1 i=2 i=3
D. i=1 i=2 i=3
[单项选择]下列程序的输出结果是______。 class T44 implements Runnable { public void run( ) { System.out.print in (Thread.currentThread ( ).getName ( ) + "运行" ); } } public class ex44 { public static void main(String[] args) { Thread t1 = new Thread(new T44( ), "t1"); Thread t2 = new Thread(new T44 ( ) , "t2"); t1.setPriority(Thread. MAX_PRIORITY); t2.setPriority(Thread.MIN_PRIORITY); t2. start ( ); t1.start ( ); } }
A. t1 运行 t2 运行
B. t2 运行 t1 运行
C. t1 运行 t1 运行
D. t2 运行 t2 运行
[单项选择]阅读下面程序
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[])

String s = "Test";
switch (s)

case "Java": System. out. print("Java"); break;
case "Language": System. out. print("Language"); break;
case "Test": System. out. print("Test"); break;



其运行结果是( )。
A. Java
B. Language
C. Test
D. 编译出错
[单项选择]执行如下程序:
public class Test
public static void main (String args[])
int x=1,a=0,b=0;
switch (x)
case 0: b++;
case 1: a++;
case 2: a++;b++;

System.out.println("a=" +a ",b=" +b);


该程序的输出结果是( )。
A. a=2,b=1
B. a=1,b=1
C. a=1,b=0
D. a=2,b=2
[填空题]阅读下列代码
public class Test
public static void main (String args[])
System.out.println(5/2);
其执行结果是 【7】

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码