旅游学院王老师对即将去国外旅游考察的同学们讲授礼貌礼节实训课。他买了几朵菊花,要求同学们不可将菊花插在送礼忌送菊花的国家。这些国家是()。
A.美国
B.澳大利亚
C.德国
D.法国
E.加拿大
A.美国
B.澳大利亚
C.德国
D.法国
E.加拿大
第1题
请阅读下面程序 public class ThreadTest{ public static void main(String args[]) (Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { System.out.prinfin("Hello"+i++); if(i=5) break; } } } 该程序创建线程使用的方法是
A.继承Thread类
B.实现Runnable接口
C.t1.start()
D.t2.start()
第2题
下面程序创建了一个线程并运行,请填空,使程序完整。
public class ThreadTest {
public static void main (String[] args) {
Hello h=Hew Hello ();
【 】
t.start ();
}
}
class Hello implements Runnable {
int i;
public void run () {
while(true) {
System.out.println("Hello" +i++);
if(i==5) break;
}
}
}
第3题
请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for Hello!"); t.join(); //等待t运行结束 } if(i==5) break;} } } class Hello extends Thread { int i; public void run() { while(true){ System.out.println("Hello"+i++); if (i==5) break;}}} 为使该程序正确执行,下划线处的语句应是
A.t.sleep()
B.t.yield()
C.t.interrupt()
D.t.start()
第4题
(24 )请阅读下面程序
public class ThreadTest {
public static void main (String args[ ]){
Thread t1 = new Thread (new Hello ()):
Thread t2 = new Thread (new Hello ()):
t l .start ():
t2.start ();
}
}
class Hello implements Runnable {
int i ;
public void run (){
while (true ) {
System.out.println ("Hello"+i++ ) ;
if (i=5 ) break :
}
}
}
该程序创建线程使用的方法是()
A )继承 Thread 类
B )实现 Runnable 接口
C ) t l.start ()
D ) t2.start ()
第5题
请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for Hello!"); t.join(); //等待t运行结束 } if(i==5) break;} } } class Hello extends Thread { int i; public void run() { while(true){ System.out.println("Hello"+i++); if (i==5) break;}}} 为使该程序正确执行,下划线处的语句应是
A.t.sleep()
B.t.yield()
C.t.interrupt()
D.t.start()
第6题
请阅读下面程序 public class ThreadTest{ public static void main(String args[])throws Ex- ception{ int i=0; Hello t=new Hello; ; while(true){ System.Out.println("Good Morning"+i++): if(i= =2t.isAlive){ System.out.println("Main waiting for Hel- lo!"); join;//等待t运行结束 } if(i= =5)break;} } } class Hello extends Thread{ int l; public void run{ while(true)(System.Out.println("Hell0"+i++); if(i= =5)break;)))
A.t.sleep
B.t.yield
C.t.interrupt
D.t.start
第7题
请阅读下面程序 public class ThreadTest{ public static void main(String args[])throws Ex- ception{ int i=0; Hello t=new Hello; ; while(true){ System.Out.println("Good Morning"+i++): if(i= =2t.isAlive){ System.out.println("Main waiting for Hel- lo!"); join;//等待t运行结束 } if(i= =5)break;} } } class Hello extends Thread{ int l; public void run{ while(true)(System.Out.println("Hell0"+i++); if(i= =5)break;)))
A.t.sleep
B.t.yield
C.t.interrupt
D.t.start
第8题
(28 )请阅读下面程序
public class ThreadTest {
public static void main (String args[ ]) throws Exception {
int i=0;
Hello t = new Hello ();
___________;
whlle (true ){
System.out.println ("Good Morning"+i++ ) ;
if (i=2 && t.isAlive ()){
System.out.println ("Main waiting for Hello ! ” );
tjoin () ; // 等待 t 运行结束
}
if (i==5 ) break :}
}
}
class Hello extends Thread {
int i ;
public void run ()笼
while (true ){
System.out.println ("Hello"+i++ ) ;
if (i=5 ) break ;}}}
为使该程序正确执行,下划线处的语句应是
A ) t.sleep ()
B ) t.yieldn ()
C ) t.interrupt ()
D ) t.start ()
第9题
阅读下面程序: public class ThreadTest { public static void main(String args[]) throws Exception { int i=0; Hello t=new Hello(); ______; While(true) } System.out.println("Good Morning"+i++); if(i==2&&t.isAlive()) { System.out.println("Main waiting for Hello!"); t.join(); //等待t运行结束 } If(i==5)break:} } } class Hello extends Thread } int i; public void run() while(true) { System.out.println("Hello"+i++): If(i==5)break; } } } 为使该程序正确执行,下画线处的语句应是
A.t.sleep()
B.t.yield()
C.t.interrupt()
D.t.start()
第10题
阅读下面程序 public cmass ThreadTest { public static void main(String args[]) { Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { System.out.println("Hello"+i++); it(i==5) break; } } } 此程序创建线程所使用的方法是
A.继承Thread类
B.实现Runnable接口
C.t1.start()
D.t2.start()
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!