<< Prev Question Next Question >>

Question 152/260

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

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

Question List (260q)
Question 1: Given: import java.io.*; class Animal { Animal() { System.ou...
Question 2: Which three code fragments, added individually at line 29, p...
Question 3: Given that the elements of a PriorityQueue are ordered accor...
Question 4: Given: 1. public class A { 2. public String doit(int x, int ...
1 commentQuestion 5: Given: abstract class A { abstract void a1(); void a2() { } ...
Question 6: Which three statements are true? (Choose three.)...
Question 7: Click the Exhibit button. 10. interface Foo{ 11. int bar(); ...
Question 8: DRAG DROP Select and Place: (Exhibit)...
Question 9: Given that c is a reference to a valid java.io.Console objec...
Question 10: Given: public class Person { private String name, comment; p...
Question 11: DRAG DROP Select and Place: (Exhibit)...
Question 12: DRAG DROP Select and Place: (Exhibit)...
Question 13: DRAG DROP Select and Place: (Exhibit)...
Question 14: DRAG DROP Add methods to the Beta class to make it compile c...
Question 15: DRAG DROP Select and Place: (Exhibit)...
Question 16: Given: public class A{ private int counter = 0; public stati...
Question 17: Given: public class SimpleCalc { public value; public void c...
Question 18: Given: import java.util.*; public class Explorer1 { public s...
Question 19: Given: 01. interface TestA { String toString(); } 02. 03. pu...
Question 20: DRAG DROP Select and Place: (Exhibit)...
1 commentQuestion 21: A programmer has an algorithm that requires a java.util.List...
Question 22: Given: 01. import java.util.*; 02. public class Example { 03...
Question 23: Given: class Snoochy { Boochy booch; public Snoochy() { booc...
Question 24: Given: public class Pass2 { public void main(String [] args)...
Question 25: Given: package com.company.application; public class MainCla...
Question 26: A class games.cards.Poker is correctly defined in the jar fi...
Question 27: Given: public class Threads5 { public static void main (Stri...
Question 28: Given: 1. d is a valid, non-null Date object 2. df is a vali...
Question 29: Given: public void go() { String o = ""; z: for(int x = 0; x...
Question 30: Given: public static void main(String[] args) { try { args =...
Question 31: Given: 1. public class Mule { 2. public static void main(Str...
Question 32: Given: 05. class Building { } 06. public class Barn extends ...
Question 33: A UNIX user named Bob wants to replace his chess program wit...
Question 34: Given: class Pizza { java.util.ArrayList toppings; public fi...
Question 35: Given: class Employee { String name; double baseSalary; Empl...
Question 36: Given: 1. public class TestOne { 2. public static void main ...
Question 37: Given: class Atom { Atom() { System.out.print("atom "); } } ...
Question 38: Given: 09. class One { 10. void foo() { } 11. } 12. 13. clas...
Question 39: Given: 04. class Payload { 05. private int weight; 06. publi...
Question 40: Given: 11. //insert code here 12. private N min, max; 13. pu...
Question 41: Given a valid DateFormat object named df, and 16. Date d = n...
Question 42: Given: public class TestOne implements Runnable { public sta...
Question 43: DRAG DROP Place the Relations on their corresponding Impleme...
Question 44: Given classes defined in two different files: package packag...
Question 45: Given: 05. class A { 06. void foo() throws Exception { throw...
Question 46: Which two scenarios are NOT safe to replace a StringBuffer o...
Question 47: Given: 01. public class Boxer1{ 02. Integer i; 03. int x; 04...
Question 48: Given a correctly compiled class whose source code is: 1. pa...
Question 49: Given: public class ItemTest { private final int id; public ...
Question 50: Given: public interface A { public void m1(); } class B impl...
Question 51: Given: 01. public class Rainbow { 02. public enum MyColor { ...
Question 52: Which capability exists only in java.io.FileWriter?...
Question 53: Given: 11. String test = "a1b2c3"; 12. String[] tokens = tes...
Question 54: Given: 10. public class SuperCalc { 11. protected static int...
Question 55: Given that c is a reference to a valid java.io.Console objec...
1 commentQuestion 56: Given: enum Example { ONE, TWO, THREE } Which statement is t...
Question 57: Given: import java.util.*; public class Mapit { public stati...
Question 58: Which statement is true about the classes and interfaces in ...
Question 59: Given: import java.io.IOException; class A { public void pro...
Question 60: Given: 1. public class Breaker2 { 2. static String o = ""; 3...
Question 61: Click the Exhibit button. Given the fully-qualified class na...
Question 62: Given: 1. import java.util.*; 2. 3. public class Explorer3 {...
Question 63: Given: int x = 0; int y = 10; do { y--; ++x; } while (x &lt;...
Question 64: Given: 84. try { 85. ResourceConnection con = resourceFactor...
Question 65: Given: interface Data { public void load(); } abstract class...
Question 66: Which code, inserted at line 14, will allow this class to co...
Question 67: Given: public class Threads2 implements Runnable { public vo...
Question 68: DRAG DROP Select and Place: (Exhibit)...
Question 69: Given: 12. String csv = "Sue,5,true,3"; 13. Scanner scanner ...
Question 70: Given: class TestA { public void start() { System.out.printl...
Question 71: Given: import java.util.TreeSet; public class Explorer2 { pu...
Question 72: Given: 01. class TestException extends Exception { } 02. cla...
Question 73: Given: package com.company.application; public class MainCla...
Question 74: Which statement is true?
Question 75: Given: 33. Date d = new Date(0); 34. String ds = "December 1...
Question 76: Given: class Thingy { Meter m = new Meter(); } class Compone...
Question 77: Given: public class PingPong implements Runnable { synchroni...
Question 78: Given: class ClassA {} class ClassB extends ClassA {} class ...
Question 79: Given: class Alligator { public static void main(String[] ar...
Question 80: DRAG DROP Given: class A { String name = "A"; String getName...
Question 81: Which two statements are true about the hashCode method? (Ch...
Question 82: Given a pre-generics implementation of a method: 11. public ...
Question 83: Given: 11. public enum Title { 12. MR("Mr."), MRS("Mrs."), M...
Question 84: Given: public static void test(String str) { int check = 4; ...
Question 85: Given: 1. public class A { 2. public void doit() { 3. } 4. 5...
Question 86: Given: 01. interface A { public void aMethod(); } 02. interf...
Question 87: Given: 33. try { 34. //some code here 35. } catch (NullPoint...
Question 88: DRAG DROP Select and Place: (Exhibit)...
Question 89: Given: 23. Object [] myObjects = { 24. new Integer(12), 25. ...
Question 90: Which three statements concerning the use of the java.io.Ser...
Question 91: Given: public class BuildStuff { public static void main(Str...
Question 92: Given: public class TestString1 { public static void main(St...
Question 93: Given: abstract class C1 { public C1() { System.out.print(1)...
Question 94: Given: public static void parse(String str) { try { float f ...
Question 95: DRAG DROP Place the correct description of the compiler outp...
Question 96: Given: class Nav{ public enum Direction { NORTH, SOUTH, EAST...
Question 97: Given: 12. Date date = new Date(); 13. df.setLocale(Locale.I...
Question 98: Given: public static void main(String[] args) { String str =...
Question 99: Given: 1. public class KungFu { 2. public static void main(S...
Question 100: DRAG DROP Select and Place: (Exhibit)...
Question 101: DRAG DROP Select and Place: (Exhibit)...
Question 102: Given: 01. public class TestString3 { 02. public static void...
Question 103: Given: public abstract class Shape { private int x; private ...
Question 104: DRAG DROP Select and Place: (Exhibit)...
Question 105: Given: 11. public void testIfA() { 12. if (testIfB("True")) ...
Question 106: Click the Exhibit button. class Foo { private int x; public ...
Question 107: Given: 11. static class A { 12. void process() throws Except...
Question 108: Given: static void test() throws Error { if (true) throw new...
Question 109: Given: class One { public One foo() { return this; } } class...
Question 110: DRAG DROP Given: Runnable r = new Runnable() { public void r...
Question 111: Given: 1. public class Plant { 2. private String name; 3. 4....
Question 112: Which four statements are true? (Choose four.)...
Question 113: Click the Exhibit button 1. public class A { 2. public void ...
Question 114: Given the following six method names: addListener (Exhibit) ...
Question 115: Given: public class TestSeven extends Thread { private stati...
Question 116: Given: 1. public class Target { 2. private int i = 0; 3. pub...
Question 117: Given: 11. String test = "Test A Test B Test C"; 12. // inse...
Question 118: Given: public class Threads4 { public static void main (Stri...
Question 119: Given: 11. class X { public void foo() { System.out.print("X...
Question 120: Given: package test; class Target { public String name = "he...
Question 121: Given: import java.util.*; public class WrappedString { priv...
Question 122: Given: 1. interface DeclareStuff { 2. public static final in...
Question 123: Which two code fragments are most likely to cause a StackOve...
Question 124: Given: import java.util.*; public class Quest { public stati...
Question 125: DRAG DROP Select and Place: (Exhibit)...
Question 126: Given: class Alpha { public void foo() { System.out.print("A...
Question 127: Click the Exhibit button. public class Threads1 { int x = 0;...
Question 128: Given: public static Collection get() { Collection sorted = ...
Question 129: Click the Exhibit button. 1. import java.util.*; 2. public c...
Question 130: Given: 11. public class Test { 12. public static void main(S...
Question 131: Given: import java.util.*; public class SortOf { public stat...
Question 132: Given: class Line { public class Point { public int x, y; } ...
Question 133: Given: public class Person { private name; public Person(Str...
Question 134: Given: 1. public class TestFive { 2. private int x; 3. 4. pu...
Question 135: Given: 01. public class Hi { 02. void m1() { } 03. protected...
Question 136: Given: public interface A111 { String s = "yo"; public void ...
Question 137: DRAG DROP Select and Place: (Exhibit)...
Question 138: Given: 01. public class LineUp { 02. public static void main...
Question 139: Given: 1. public class Venus { 2. public static void main(St...
Question 140: Given: 1. public class Test { 2. public enum Dogs {collie, h...
Question 141: A company that makes Computer Assisted Design (CAD) software...
Question 142: What is the result? 11. public class Person { 12. String nam...
Question 143: Given classes defined in two different files: package util; ...
Question 144: Given: 04. public class Tahiti { 05. Tahiti t; 06. 07. publi...
Question 145: Assuming that the serializeBanana() and the deserializeBanan...
Question 146: Given: interface Fish { } class Perch implements Fish { } cl...
Question 147: Given that: Gadget has-a Sprocket and Gadget has-a Spring an...
Question 148: Given: void waitForSignal() { Object obj = new Object(); syn...
Question 149: Given: 1. public class Threads3 implements Runnable { 2. pub...
Question 150: Given that the current directory is empty, and that the user...
Question 151: DRAG DROP Select and Place: (Exhibit)...
Question 152: Given: foo and bar are public references available to many o...
Question 153: Given a method that must ensure that its parameter is not nu...
Question 154: Given: class PingPong2 { synchronized void hit(long n) { for...
Question 155: Click the Exhibit button. (Exhibit) What is the result?...
Question 156: Given: 12. public class Commander { 13. public static void m...
Question 157: Given: public class Batman { int squares = 81; public static...
Question 158: Which Man class properly represents the relationship "Man ha...
Question 159: Given: public class Hello { String title; int value; public ...
Question 160: Given: public class Spock { public static void main(String[]...
Question 161: Given: 11. public static void main(String[] args) { 12. Inte...
Question 162: Given that the current directory is empty, and that the user...
Question 163: Given: interface Jumper { public void jump(); } class Animal...
Question 164: Given that Triangle implements Runnable, and: (Exhibit) Whic...
Question 165: Given: 31. //some code here line 31 32. try { 33. //some cod...
Question 166: Given: 11. abstract class Vehicle { public int speed() { ret...
Question 167: Given: public class Yippee { public static void main(String ...
Question 168: Given: 03. import java.util.*; 04. public class Hancock { 05...
Question 169: Given: class Foo { static void alpha() { /* more code here *...
Question 170: Given: 11. class Converter { 12. public static void main(Str...
1 commentQuestion 171: Given: class Animal { public String noise() { return "peep";...
Question 172: DRAG DROP Select and Place: (Exhibit)...
Question 173: Given: public class Donkey { public static void main(String[...
Question 174: Given: class Mammal { } class Raccoon extends Mammal { Mamma...
Question 175: Which two statements are true? (Choose two.)...
Question 176: DRAG DROP Select and Place: (Exhibit)...
Question 177: Which two classes correctly implement both the java.lang.Run...
Question 178: Given: 10. interface Foo {} 11. class Alpha implements Foo {...
Question 179: Given a class Repetition: package utils; public class Repeti...
Question 180: Which three will compile and run without exception? (Choose ...
Question 181: Given: 11. public void go(int x) { 12. assert (x &gt; 0); 13...
Question 182: Given: static void test() { try { String x = null; System.ou...
Question 183: A team of programmers is reviewing a proposed API for a new ...
Question 184: A company has a business application that provides its users...
Question 185: DRAG DROP Select and Place: (Exhibit)...
Question 186: Given: public class NamedCounter { private final String name...
Question 187: Which can appropriately be thrown by a programmer using Java...
Question 188: Given: public class Test { public enum Dogs {collie, harrier...
Question 189: Given: 08. abstract public class Employee { 09. protected ab...
Question 190: Given: 01. import java.io.*; 02. 03. public class Talk { 04....
Question 191: Given: class Foo { public int a = 3; public void addFive() {...
Question 192: Given: 3. import java.util.*; 4. public class G1 { 5. public...
Question 193: Given: 01. public class Blip { 02. protected int blipvert(in...
Question 194: Given 11. public interface Status { 12. /* insert code here ...
Question 195: Given: public static void main(String[] args) { for (int i =...
Question 196: Given: public class Breaker { static String o = ""; public s...
Question 197: A programmer must create a generic class MinMax and the type...
Question 198: Given: 09. class Line { 10. public static class Point {} 11....
Question 199: Given that t1 is a reference to a live thread, which is true...
Question 200: Given the following directory structure: bigProject |--sourc...
Question 201: Given: 01. public class Mud { 02. //insert code here 03. Sys...
Question 202: Given: interface A { void x(); } class B implements A { publ...
Question 203: Given: 11. public static void main(String[] args) { 12. Obje...
Question 204: Given: public class Foo { static int[] a; static { a[0]=2; }...
Question 205: Given: public class Key { private long id1; private long id2...
Question 206: Given: 11. String test = "This is a test"; 12. String[] toke...
Question 207: Given: public class Pass { public static void main(String []...
Question 208: A team of programmers is involved in reviewing a proposed de...
Question 209: DRAG DROP Select and Place: (Exhibit)...
Question 210: Given: public class Score implements Comparable&lt;Score&gt;...
Question 211: Given: public class Drink implements Comparable { public Str...
Question 212: Given: String[] elements = { "for", "tea", "too" }; String f...
Question 213: DRAG DROP Select and Place: (Exhibit)...
Question 214: Given: public class Person { private String name; public Per...
Question 215: DRAG DROP Place the code fragments in position to complete t...
Question 216: A developer is creating a class Book, that needs to access c...
Question 217: Given: package geometry; public class Hypotenuse { public In...
Question 218: Click the Exhibit button. 1. public class GoTest { 2. public...
Question 219: Given: public class Base { public static final String FOO = ...
Question 220: DRAG DROP Place the code elements in positions so that the F...
Question 221: Given: 35. String #name = "Jane Doe"; 36. int $age = 24; 37....
Question 222: Click the Exhibit button. 1. public class Car { 2. private i...
Question 223: DRAG DROP Select and Place: (Exhibit)...
Question 224: Which two code fragments will execute the method doStuff() i...
Question 225: Given a class whose instances, when found in a collection of...
Question 226: Given: public static Iterator reverse(List list) { Collectio...
Question 227: Given: 1. class X { 2. X() { System.out.print(1); } 3. 4. X(...
Question 228: Given: public class Donkey2 { public static void main(String...
Question 229: DRAG DROP Place the code fragments into position to produce ...
Question 230: Given: 01. public class A{ 02. public void method1() { 03. t...
Question 231: Given: 1. public class GC { 2. private Object o; 3. private ...
Question 232: Given: import java.io.*; public class Forest implements Seri...
Question 233: Which two statements are true? (Choose two.)...
Question 234: Given classes defined in two different files: package util; ...
Question 235: Given: 34. HashMap props = new HashMap(); 35. props.put("key...
Question 236: Given: 22. StringBuilder sb1 = new StringBuilder("123"); 23....
Question 237: Given: NumberFormat nf = NumberFormat.getInstance(); nf.setM...
Question 238: Given: 11. public void genNumbers() { 12. ArrayList numbers ...
Question 239: Given: package com.sun.scjp; public class Geodetics { public...
Question 240: DRAG DROP Select and Place: (Exhibit)...
Question 241: DRAG DROP Select and Place: (Exhibit)...
Question 242: Given: import java.util.Date; import java.text.DateFormat; 2...
Question 243: Given: Float pi = new Float(3.14f); if (pi &gt; 3) { System....
Question 244: Given: public class ClassA { public void methodA() { ClassB ...
Question 245: Given: 01. class Super { 02. private int a; 03. protected Su...
Question 246: What is the output if the main() method is run? public class...
Question 247: Given two files, GrizzlyBear.java and Salmon.java: 01. packa...
Question 248: Given: 09. interface Foo { int bar(); } 10. 11. public class...
Question 249: Given: static void test() throws RuntimeException { try { Sy...
Question 250: Given: 01. interface Animal { void makeNoise(); } 02. class ...
Question 251: Given: 11. double input = 314159.26; 12. NumberFormat nf = N...
Question 252: Given: interface DoStuff2 { float getRange(int low, int high...
Question 253: Given: 21. class Money { 22. private String country = "Canad...
Question 254: Given: class ClassA { public int numberOfInstances; protecte...
Question 255: Which two code fragments correctly create and initialize a s...
Question 256: Given: Runnable r = new Runnable() { public void run() { Sys...
Question 257: Given: public class Yikes { public static void go(Long n) { ...
Question 258: Given: 01. public class Person { 02. private String name; 03...
Question 259: Given: public class Barn { public static void main(String[] ...
Question 260: Given: 1. import java.util.*; 2. 3. public class LetterASort...