阅读下面程序public class Test2 { public static void main(String[] args) { int a=10,b=4.c=
阅读下面程序 public class Test2 { public static void main(String[] args) { int a=10,b=4.c=20,d=6; System.out.println(a++*b+c*--d); } } 程序运行的结果是
A.144
B.160
C.140
D.164
阅读下面程序 public class Test2 { public static void main(String[] args) { int a=10,b=4.c=20,d=6; System.out.println(a++*b+c*--d); } } 程序运行的结果是
A.144
B.160
C.140
D.164
阅读下面程序 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();
阅读下面程序 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 Test2______ { public static void main(String[] args){ Thread t=new Test2(); t. start(); } public void run(){ System. out. priatln("How are you. "); } } 在程序下画线处填入的正确的选项是
A.implements Thread
B.extends Runnable
C.implements Runnable
D.extends Thread
阅读下面程序 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();
阅读下面小程序,选出正确答案()。 public class TestString { public static void main(String[] args) { String str = "I am a String!"; int n=str.length(); char c=str.charAt(7); System.out.println(n); System.out.println(c); } }
A、14 S
B、14 t
C、11 S
D、10 r
阅读下面程序
public class OperatorsAndExpressions {
String conditionalExpression(int score) {
String result;
//如果score超过60分,则结果是passed,否则是doesn't pass
result=(score>=60)?"passed":"doesn't pass":
System.out.println(result);
return result;
}
public static void main(String args[]) {
OperatorsAndExpressions perAndExp=new OperatorsAndExpressions();
//条件表达式
OperAndExp.conditionalExpression(65);
}
}
程序的执行结果是______。
请阅读下面程序 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 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()
阅读下面程序 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 static void main(String[] args){
Test t = new Test();
t.start();
}
public void run(){ }
}
下列关于上述程序的叙述正确的是
A) 程序不能通过编译,因为 start() 方法在 Test 类中没有定义
B) 程序编译通过,但运行时出错,提示 start() 方法没有定义
C) 程序不能通过编译,因为 run() 方法没有定义方法体
D) 程序编译通过,且运行正常
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!