阅读下面程序Strings="Hello";Stringt=s;t="1234"s="4321"t代表的字符串为()
A.null
B.1234
C.Hello
D.4321
- · 有5位网友选择 D,占比62.5%
- · 有3位网友选择 B,占比37.5%
A.null
B.1234
C.Hello
D.4321
A.null
B.1234
C.Hello
D.4321
给出下面程序: public class ex51 { public static void main(String[] args) { String s = "hello"; String t = "hello"; char c[] = {'h', 'e', '1', '1', 'o'}; System. out. println (______) } } 在程序的横线处填入下列______选项后,程序输出的结果是true。
A.t.equals(c)
B.s.equals?
C.s == t
D.t == c
A.helloworld
B.hello,world
C.HELLOWORLD
D.HELLO,WORLD
阅读下面程序 public void test() { try{ sayHello(); System.out.println("hello"); } catch(ArrayIndexOutOfBoundException e) { System.out.println("ArrayIndexOutOfBoundException"); } catch(Exception e) { System.out.println("Exception"); } finally { System.out.println("finally");} } 如果sayHello()方法正常运行,则test()方法的运行结果将是
A.Hello
B.ArraylndexOutOfBondsException
C.Exception Finally
D.Hello Finally
阅读下面程序 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()
阅读下面程序: 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()
请阅读下面程序 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
阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是
A.Test t=flew Test()
B.Thread t=new Thread();
C.Thread t=new Thread(new Test());
D.Test t=new Thread();
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!