单选题Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?Afoo.notify();Bbar.notify();Cfoo.notifyAll();DThread.notify();Ebar.notifyAll();

单选题
Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?
A

foo.notify();

B

bar.notify();

C

foo.notifyAll();

D

Thread.notify();

E

bar.notifyAll();


参考解析

解析: 暂无解析

相关考题:

多选题Given: And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory). Which two java commands entered at the commandline will run MainClass?()Ajava MainClass if run from the /apps directoryBjava com.company.application.MainClass if run from the /apps directoryCjava -classpath /apps com.company.application.MainClass if run from any directoryDjava -classpath . MainClass if run from the /apps/com/company/application directoryEjava -classpath /apps/com/company/application:. MainClass if run from the /apps directory

单选题Given: What is the result?()A 23B 234C 235D Compilation fails.

单选题Given: 11.double input = 314159.26; 12.NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); 13.String b; 14.//insert code here Which code, inserted at line 14, sets the value of b to 314.159,26?()Ab = nf.parse( input );Bb = nf.format( input );Cb = nf.equals( input );Db = nf.parseObject( input );

多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used to implement sorting allows this class to define only one sort sequence.DThe interface used to implement sorting allows this class to define many different sort sequences.

单选题Given: What is the result?()A No output is produced. 1 2 3B No output is produced. 2 3 4C No output is produced. 1 2 3 4D An exception is thrown at runtime. 1 2 3

多选题Which two code fragments are most likely to cause a StackOverflowError?()Aint []x = {1,2,3,4,5};for(int y = 0; y  6; y++)    System.out.println(x[y]);Bstatic int[] x = {7,6,5,4};static { x[1] = 8;x[4] = 3; }Cfor(int y = 10; y  10; y++)doStuff(y);Dvoid doOne(int x) { doTwo(x); }void doTwo(int y) { doThree(y); }void doThree(int z) { doTwo(z); }Efor(int x = 0; x  1000000000; x++) doStuff(x);Fvoid counter(int i) { counter(++i); }

单选题Given: What is the result?()A Compilation fails due to an error in line 23.B Compilation fails due to an error in line 29.C A ClassCastException occurs in line 29.D A ClassCastException occurs in line 31.E The value of all four objects prints in natural order.

多选题Which two code fragments correctly create and initialize a static array of int elements?()Astatic final int[] a = { 100,200 };Bstatic final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }Cstatic final int[] a = new int[2]{ 100,200 };Dstatic final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }

多选题Given: 35.String #name = "Jane Doe"; 36.int $age = 24; 37.Double _height = 123.5; 38.double ~temp = 37.5; Which two statements are true?()ALine 35 will not compile.BLine 36 will not compile.CLine 37 will not compile.DLine 38 will not compile.

单选题Given: What is the result?()A 2.1.0B 2.1.1C 3.2.1D 3.2.2

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.