1)Choose the correct statement about gridbag layout:
A. The weightx & weighty should have values between 0.0 & 1.0
B. If you specify the fill field is BOTH, there is no meaning to set anchor field
C. If you specify anchor field there is no meaning to set fill field is BOTH
Answer is A,B,C.I try it and find no one correct.Am I right?
2)What is the method used to schedule a
thread for execution?
Answer is public void run(){}.I think is start();
3)Choose the correct one about thread:
A. The threads from one class ends at the same time.
B. when JVM exists the main method, it will stop only after all the
threads are stopped.
C. if there are multiple threads, reading or writing of data of class
is inconsitent.
D. programmer has to write a special program for garbagecollection in
multiple threads.
Answer is B,C.I think only C is correct.
4)Which statements are true about listeners?
A. The return value from a listener is of boolean type.
B. Most components allow multiple listeners to be added.
C. A copy of the original event is passed into a listener
method.
D. If multiple listeners are added to a single component,
they all must all be friends to each other.
E. If the multiple listeners are added to a single component,
the order [in which listeners are called is guaranteed].
Answer is B,C.I see other answer only B is correct.Whether C is answer?
5)What might cause the current thread to stop executing?
A. An InterruptedException is thrown
B. The thread executes a sleep() call
C. The thread constructs a new Thread
D. A thread of higher priority becomes ready (runnable)
E. The thread executes a read() call on an InputStream
Answer is A,B,D,E.I think is only B,D.
6)Which statement is true about an inner class?
A. It must be anonymous
B. It can not implement an interface
C. It is only accessible in the enclosing class
D. It can only be instantiated in the enclosing class
E. It can access any final variables in any enclosing scope.
Answer is E.I think No one is correct.
7)Consider the following code:
1. public void method(
String s){
2. String a,b;
3. a = new String("Hello");
4. b = new String("Goodbye");
5. System.out.println(a + b);
6. a = null;
7. a = b;
8. System.out.println(a + b);
9. }
where is it possible that the garbage collector will run the first time?
A. Just before line 5
B. Just before line 6
C. Just before line 7
D. Just before line 8
E. Never in this method
Answer is C.I see other answer is B.I don't know which is correct.