8. Which expressions are true? (3 Points)( )
A String s="Hello "; int i=3; s+=i;
B String s=" Hello "; int i=3; if(i==s){ s+=i};
C String s=" Hello "; int i=3; s=i+s;
D String s=" Hello"; int i=3; s=i+;
E. String s=null; int i=(s!=null)&&(s.length>0)?s.length():0;
9. Which methods can create a runable class? (3 Points)
A public class X implements Runable{ public void run(){ ......} }
B public class X implements Thread{ public void run(){ ......} }
C public class X implements Thread{ public int run(){ ......} }
D public class X implements Runable{ protected void run(){ ......} }
E.public class X implements Thread{ public void run(){ ......} }
10. Which statements below are true? (3 Points)
A java.lang.Clonable is a class
B java.lang.Runnable is an interface
C Double object is in the java.lang package
D The expression “Double a=1.0” is true.
11. Which statement or statements are true about the code listed below? (3 Points)
public class MyTextArea extends TextArea {
public MyTextArea(int nrows, int ncols) {
enableEvents(AWTEvent.TEXT_
EVENT_MASK);
}
public void processTextEvent (TextEvent te) {
System.out.println(“Processing a text event.”);
}
}
A. The source code must appear in a file called MyTextArea.java
B. Between lines 2 and 3, a call should be made to super(nrows, ncols) so that the new component will have the correct size.
C. At line 6, the return type of processTextEvent() should be declared boolean, not void.
D. Between lines 7 and 8, the following code should appear: return true.
E. Between lines 7 and 8, the following code should appear: super.processTextEvent(te).