class Computation extends Thread { private int num; private boolean isComplete; private int result; public Computation(int num) { this.num = num; } public synchronized void run() { result = num * 2; isComplete = true; notify(); } public synchronized int getResult() { while (!isComplete) { try { wait(); } catch (InterruptedException e) { } } return result; } public static void main(String[] args) { Computation[] computations = new Computation [4]; for (int i = 0; i computations.length; i++) { computations[i] = new Computation(i); computations[i] .start(); } for (Computation c : computations) System.out.print(c.getResult() +“ “); } } What is the result?() A、 The code will deadlock.B、 The code may run with no output.C、 An exception is thrown at runtime.D、 The code may run with output “0 6”.E、 The code may run with output “2 0 6 4‟.F、 The code may ruin with output “0 2 4 6”.
class Computation extends Thread { private int num; private boolean isComplete; private int result; public Computation(int num) { this.num = num; } public synchronized void run() { result = num * 2; isComplete = true; notify(); } public synchronized int getResult() { while (!isComplete) { try { wait(); } catch (InterruptedException e) { } } return result; } public static void main(String[] args) { Computation[] computations = new Computation [4]; for (int i = 0; i < computations.length; i++) { computations[i] = new Computation(i); computations[i] .start(); } for (Computation c : computations) System.out.print(c.getResult() +“ “); } } What is the result?()
- A、 The code will deadlock.
- B、 The code may run with no output.
- C、 An exception is thrown at runtime.
- D、 The code may run with output “0 6”.
- E、 The code may run with output “2 0 6 4‟.
- F、 The code may ruin with output “0 2 4 6”.
相关考题:
ext 怎么动态修改xtype Ext.extend(Ext.Window, {title: '任务查询',width: 900,height: 580,padding: 10,layout:'form',。。。的form怎麼提交,谢谢!
下面能够制作进度条的是()。 A.Ext.MessageBox.alertB.Ext.MessageBox.showC.Ext.MessageBox.confimD.Ext.MessageBox.prompt
在做Ext的时候,下面哪个文件不是必须的()。 A.resources/css/ext-all.CssB.adapter/ext/ext-base.JsC.ext-debug.jsD.ext-all.js
下面不是创建一个Ext表格控件必须的项的是()。 A.Ext.grid.ColumnModuleB.Ext.data.StoreC.Ext.data.MemoryProxyD.Ext.grid.GridPanel
下面不是创建一个Ext表格控件必须的项的是()。A、Ext.grid.ColumnModuleB、Ext.data.StoreC、Ext.data.MemoryProxyD、Ext.grid.GridPanel
下面能够制作进度条的是()。A、Ext.MessageBox.alertB、Ext.MessageBox.showC、Ext.MessageBox.confimD、Ext.MessageBox.prompt
在做Ext的时候,下面哪个文件不是必须的()。A、resources/css/ext-all.CssB、adapter/ext/ext-base.JsC、ext-debug.jsD、ext-all.js
A developer is creating a class Book that needs to access class Paper.The Paper class is deployed in a JARnamedmyLib.jar.Whichthree,taken independently,will allow the developer to use the Paper class while compiling the Book class?()A、The JAR fileis located at$JAVA_HOME/jre/classes/myLib.jar.B、The JAR fileis located at$JAVA_HOME/jre/lib/ext/myLib.jar.C、TheJ AR fileis located at/foo/myLib.jar and aclasspath environment variable is set that includes /foo/myLib.jar/Paper.class.D、The JAR fileis located at/foo/myLib.jar and a classpath environment variable is set that includes/foo/myLib.jar.E、The JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-cp/foo/myLib.jar/Paper Book.java.F、The JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-classpath/foo/myLib.jar Book.java.
我们讨论的计算思维中的计算一词,指英语中的()。A、computationB、computingC、computation and computingD、neither computation no computing
单选题在做Ext的时候,下面哪个文件不是必须的()。Aresources/css/ext-all.CssBadapter/ext/ext-base.JsCext-debug.jsDext-all.js
单选题class ClassA { public int numberOfinstances; protected ClassA(int numberOfinstances) { this.numberOflnstances = numberOfinstances; } } public class ExtendedA extends ClassA { private ExtendedA(int numberOfinstances) { super(numberOflnstances); } public static void main(String[] args) { ExtendedA ext = new ExtendedA(420); System.out.print(ext.numberOflnstances); } } Which is true?()A 420 is the output.B An exception is thrown at runtime.C All constructors must be declared public.D Constructors CANNOT use the private modifier.E Constructors CANNOT use the protected modifier.
填空题Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object. class Base { public void print( ) { System.out.println("base"); } } class Extention extends Base { public void print( ) { System.out.println("extension"); // insert line of implementation here } } public class Q294d { public static void main(String args[]) { Extention ext = new Extention( ); ext.print( ); } } Fill in a single line of implementation.()
多选题A developer is creating a class Book that needs to access class Paper.The Paper class is deployed in a JARnamedmyLib.jar.Whichthree,taken independently,will allow the developer to use the Paper class while compiling the Book class?()AThe JAR fileis located at$JAVA_HOME/jre/classes/myLib.jar.BThe JAR fileis located at$JAVA_HOME/jre/lib/ext/myLib.jar.CTheJ AR fileis located at/foo/myLib.jar and aclasspath environment variable is set that includes /foo/myLib.jar/Paper.class.DThe JAR fileis located at/foo/myLib.jar and a classpath environment variable is set that includes/foo/myLib.jar.EThe JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-cp/foo/myLib.jar/Paper Book.java.FThe JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-classpath/foo/myLib.jar Book.java.
多选题A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class?()AThe JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.BThe JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar..CThe JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class.DThe JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar.EThe JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp /foo/myLib.jar/Paper Book.java.FThe JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d /foo/myLib.jar Book.javaGThe JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -classpath /foo/myLib.jar Book.java
多选题A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class?()AThe JAR file is located at $JAVA_HOME/jre/classes/myLib.jarBThe JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jarCThe JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.classDThe JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jarEThe JAR file is located at /foo/myLib.jar and the Book class is compiled using javac –cp /foo/myLib.jar/Paper Book.javaFThe JAR file is located at foo/myLib.jar and the Book class is compiled using javac –classpath /foo/myLib.jar Book.java
单选题class Computation extends Thread { private int num; private boolean isComplete; private int result; public Computation(int num) { this.num = num; } public synchronized void run() { result = num * 2; isComplete = true; notify(); } public synchronized int getResult() { while (!isComplete) { try { wait(); } catch (InterruptedException e) { } } return result; } public static void main(String[] args) { Computation[] computations = new Computation [4]; for (int i = 0; i computations.length; i++) { computations[i] = new Computation(i); computations[i] .start(); } for (Computation c : computations) System.out.print(c.getResult() +“ “); } } What is the result?()A The code will deadlock.B The code may run with no output.C An exception is thrown at runtime.D The code may run with output “0 6”.E The code may run with output “2 0 6 4‟.F The code may ruin with output “0 2 4 6”.