1.which statement about the garbage collection mechanism are true? a.garbage collection require additional program code in cases where multiple threads are running. b.the programmer can indicate that a reference through a local variable is no longer of interest. c.the programmer has a mechanism that explicit and immediately frees the memory used by java objects. d.the garbage collection mechanism can free the memory used by java object at expectable time. e.the garbage collection system never reclaims memory from objects while are still accessible to running user threads.
2. give the following method: 1)public void method( ){ 2) string a,b. 3) a=new string(“hello world”). 4) b=new string(“game over”). 5) system.out.println(a b ”ok”). 6) a=null. 7) a=b. system.out.println(a). 9) } in the absence of compiler optimization, which is the earliest point the object a referred is definitely hand to be garbage collection. a. before line 3 b.before line 5 c. before line 6 d.before line 7 e. before line 9
3. which statement about listener is true? a.most component allow multiple listeners to be added. b.if multiple listener be add to a single component, the event only affected one listener. c.component don’t allow multiple listeners to be add. d.the listener mechanism allows you to call an addxxxlistener method as many times as is needed, specifying as many different listeners as your design require.
4.give the following code: public class example{ public static void main(string args[] ){ int l=0. do{ system.out.println(“doing it for l is:” l). }while(--l>.0) system.out.println(“finish”). } } which well be output: a. doing it for l is 3b. doing it for l is 1c. doing it for l is 2 d. doing it for l is 0e. doing it for l is –1f. finish
5. give the code fragment: 1)switch(x){ 2) case 1: system.out.println(“test 1”).break. 3) case 2: 4) case 3: system.out.println(“test 2”).break. 5) default: system.out.println(“end”). 6) } which value of x would cause “test 2” to the output: a. 1b. 2c. 3d. default