杭州天丽科技有限企业 JAVA 高级程序员选择题 1: 1. What will be the result of executing the following code? 2. boolean a = true; 3. boolean b = false; 4. boolean c = true; 5. if (a == true) 6. if (b == true) 7. if (c == true) System.out.println("Some things are true in this world"); 8. else System.out.println("Nothing is true in this world!"); 9. else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false"); 10. else System.out.println("Hey this won't compile"); 11. 12.Choices: A.The code won't compile B."Some things are true in this world" will be printed C."Hey this won't compile" will be printed D.None of these 2: Which of the following statements are true? A.The automatic garbage collection of the JVM prevents programs from ever running out of memory B.A program can suggest that garbage collection be performed and force it C.Garbage collection is platform independent D.An object becomes eligible for garbage collection when all references denoting it are set to null. 3: 1. What will happen when you attempt to compile and run the following code? 2. 3. class Base 4. 5. { 6. 7. int i = 99; 8. 9. public void amethod() 10. 11.{ 12. 13. System.out.println("Base.amethod()"); 14. 15. } 16. 17. Base() 18. 19.{ 20. 21. amethod(); 22. 23. } 24. 25.} 26. 27.public class Derived extends Base 28. 29.{ 30. 31.int i = -1; 32. 33. 34. 35.public static void main(String argv[]) 36. 37.{ 38. 39. Base b = new Derived(); 40. 41. System.out.println(b.i); 42. 43. b.amethod(); 44. 45. } 46. 47. public void amethod() 48. 49.{ 50. 51. System.out.println("Derived.amethod()"); 52. 53. } 54. 55.} 56. 57.Choices: A.Derived.amethod() -1 Derived.amethod() B.Derived.amethod() 99...