SCJP 6.0認證教戰手冊考題1-100

Post on 14-Oct-2014

713 views 14 download

Tags:

Transcript of SCJP 6.0認證教戰手冊考題1-100

SCJP 6.0

SCJP 6.0

1-100 244 1 Given: 35. 36. 37. 38. String #name = "Jane Doe"; int $age = 24; Double _height = 123.5; double ~temp = 37.5;

Which two statements are true? (Choose two.) A. Line 35 will not compile. B. Line 36 will not compile. C. Line 37 will not compile. D. Line 38 will not compile. AD 2-4 Java

2 Given: 1. 2. 3. 4. 5. 6. 7. A. B. C. D. E. F. 42 420 462 42042 Compilation fails. An exception is thrown at runtime. public class TestString1{ public static void main(String[] args){ String str = "420"; str += 42; System.out.print(str); } }

What is the output?

D 3-3

3 Given: 1. 2. 3. public class Test{ public static void main(String[] args){ int x = 5;

1

SCJP 6.0 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. A. B. C. D. E. F. G. 2 3 12 23 123 Compilation fails. An exception is thrown at runtime. boolean b1 = true; boolean b2 = false; if((x==4) && !b2) System.out.print("1 "); System.out.print("2 "); if((b2=true) && b1) System.out.print("3 "); } }

What is the result?

D 4-1

4 Given: 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. A. B. C. D. E. F. 00 0001 000120 00012021 Compilation fails. An exception is thrown at runtime. public void go(){ String o = ""; z: for(int x=0; x