QUESTION NO: 114 Thread Z holds the lock on object A. Thread X is blocked inside a wait call on ObjectA. What allows thread X to become runnable? A. Thread X is interrupted.// it will not interrupte the X because x is waiting. B. Thread X is interrupted. C. Thread X’s wait() times out. // ok D. Thread Z calls Thread.sleep(100); E. Thread Z releases the lock on A and calls the notify() method on thread X. F. Thread Z releases the lock on A and calls the notifyAll() method on objectA. // ok, objectA will be the original notify source QUESTION NO: 113 Given: 1. public class SyncTest { 2. private int x; 3. private int y; 4. private synchronized void setX( int i ) { x = i; } 5. private synchronized void setY( int i ) { y = i; } 6. public void setXY( int i ) { setX(i); setY(i); } 7. public synchronized boolean check() { return x != y; } 8. } Under which condition will check return true when called from a different class? A. check can never return true. B. check can return true when setXY is called by multiple threads. C. check can return true when multiple threads call setX and setY separately. // this maybe ok. Thread A setX(1), Thread B setY(1) make the check return false. D. check can return true only if SyncTest is changed to allow x and y to be set separately. QUESTION NO: 107 Which three demonstrate an “is a” relationship? (Choose three) A. public class X { } public class Y extends X { } // ok B. public interface Shape { } public interface Rectangle extends Shape{ } // ok C. public interface Color { } // use public class Shape { private Color color; } D. public interface Species { } use public class Animal { private Species species; } E. public class Person { } public class Employee { public Employee(Person person) { }// pass the parameter F. interface Component { } // ok, I guess class Container implements Component { private Component[] children; }有没有人能解释一下? 还有两个其它问题: QUESTION NO: 104 // I don't know the wrapper meaning?????? Given that b and c refer to instances of wrapper classes, which two statements are true? (Choose two) A. b.equals(b) returns true. B. b.equals(c) returns the same result as b == c. C. b.eqials(c) can return false even if c.equals(b) returns true. D. b.equals(c) throws an exception if b and c are different wrapper types. E. b.equals(c) returns false if the type of wrapper objects being compared are different.Answer: B, C对于答案C,能不能举个例子啊? QUESTION NO: 97 Given: 1. public class Alpha{ 2. private static Character() ids; // () is wrong. [] is ok. ids is a object array. 3. 4. public static void main( String[] args){ 4. ids = new Character[args.length]; 5. for (int i=0; i<ids.length; i++){ 6. ids[i] = new Character( args[i] ); 7. System.out.print( ids[i] ); 8. } 9. } 10. } What is correct? A. Compilation fails. B. The code runs with no output. C. An exception is thrown at runtime. D. The code runs, outputing a concatenated list of the arguments passed to the program. Answer: A Explanation: Compilation fails. Line 2: Return Type required其中:2. private static Character() ids;是什么意思,ids是干什么的?
113---b
107---abf
104不懂,B也对吗?那String中的equals()方法是怎么回事啊?是不是要看继承于object的
equals()方法有没有被重载?97我想private static Character() ids;这一句是不是故意把[]写错成(),然后考考我们啊?
Thread Z holds the lock on object A. Thread X is blocked inside a wait call on ObjectA.
What allows thread X to become runnable?
A. Thread X is interrupted.// it will not interrupte the X because x is waiting.
B. Thread X is interrupted.
C. Thread X’s wait() times out. // ok
D. Thread Z calls Thread.sleep(100);
E. Thread Z releases the lock on A and calls the notify() method on thread X.
F. Thread Z releases the lock on A and calls the notifyAll() method on objectA.
// ok, objectA will be the original notify source
QUESTION NO: 113
Given:
1. public class SyncTest {
2. private int x;
3. private int y;
4. private synchronized void setX( int i ) { x = i; }
5. private synchronized void setY( int i ) { y = i; }
6. public void setXY( int i ) { setX(i); setY(i); }
7. public synchronized boolean check() { return x != y; }
8. }
Under which condition will check return true when called from a different class?
A. check can never return true.
B. check can return true when setXY is called by multiple threads.
C. check can return true when multiple threads call setX and setY separately.
// this maybe ok. Thread A setX(1), Thread B setY(1) make the check return false. D. check can return true only if SyncTest is changed to allow x and y to be set
separately.
QUESTION NO: 107
Which three demonstrate an “is a” relationship? (Choose three)
A. public class X { }
public class Y extends X { } // ok
B. public interface Shape { }
public interface Rectangle extends Shape{ } // ok
C. public interface Color { } // use
public class Shape { private Color color; }
D. public interface Species { } use
public class Animal { private Species species; }
E. public class Person { }
public class Employee {
public Employee(Person person) { }// pass the parameter
F. interface Component { } // ok, I guess
class Container implements Component {
private Component[] children;
}有没有人能解释一下?
还有两个其它问题:
QUESTION NO: 104 // I don't know the wrapper meaning??????
Given that b and c refer to instances of wrapper classes, which two statements are
true? (Choose two)
A. b.equals(b) returns true.
B. b.equals(c) returns the same result as b == c.
C. b.eqials(c) can return false even if c.equals(b) returns true.
D. b.equals(c) throws an exception if b and c are different wrapper types.
E. b.equals(c) returns false if the type of wrapper objects being compared are
different.Answer: B, C对于答案C,能不能举个例子啊?
QUESTION NO: 97
Given:
1. public class Alpha{
2. private static Character() ids; // () is wrong. [] is ok. ids is a object array.
3.
4. public static void main( String[] args){
4. ids = new Character[args.length];
5. for (int i=0; i<ids.length; i++){
6. ids[i] = new Character( args[i] );
7. System.out.print( ids[i] );
8. }
9. }
10. }
What is correct?
A. Compilation fails.
B. The code runs with no output.
C. An exception is thrown at runtime.
D. The code runs, outputing a concatenated list of the arguments passed to the program.
Answer: A
Explanation: Compilation fails. Line 2: Return Type required其中:2. private static Character() ids;是什么意思,ids是干什么的?