QUESTION 57 Given: class Foo { public int a = 3; public void addFive() { a += 5; System.out.print("f "); } }class Bar extends Foo { public int a = 8; public void addFive() { this.a += 5; System.out.print("b " ); } } Invoked with: Foo f = new Bar(); f.addFive(); System.out.println(f.a); What is the result? A. b 3 B. b 8 C. b 13 D. f 3 E. f 8 F. f 13 G. Compilation fails. H. An exception is thrown..
QUESTION 56 Which two classes correctly implement both the java.lang.Runnable and the java.lang. Cloneable interfaces? (Choose two.) A. public class Session implements Runnable, Cloneable { public void run(); public Object clone(); } B. public class Session extends Runnable, Cloneable { public void run() { /* do something */ } public Object clone() { /* make a copy */ } } C. public class Session..
QUESTION 55 Given: 6. public class Threads2 implements Runnable { 7. 8. public void run() { 9. System.out.println("run."); 10. throw new RuntimeException("Problem"); 11. } 12. public static void main(String[] args) { 13. Thread t = new Thread(new Threads2()); 14. t.start(); 15. System.out.println("End of method."); 16. } 17. } Which two can be results? (Choose two.) A. java.lang.RuntimeException..
QUESTION 54 Given: 10. public class SuperCalc { 11. protected static int multiply(int a, int b) { return a * b;} 12. } and: 20. public class SubCalc extends SuperCalc{ 21. public static int multiply(int a, int b) { 22. int c = super.multiply(a, b); 23. return c; 24. } 25. } and: 30. SubCalc sc = new SubCalc (); 31. System.out.println(sc.multiply(3,4)); 32. System.out.println(SubCalc.multiply(2,2..
QUESTION 53 A company has a business application that provides its users with many different reports: receivables reports, payables reports, revenue projects, and so on. The company has just purchased some new, state-of-the-art, wireless printers, and a programmer has been assigned the task of enhancing all of the reports to use not only the company's old printers, but the new wireless printers ..
QUESTION 52 Given: String[] elements = { "for", "tea", "too" }; String first = (elements.length > 0) ? elements[0] : null; What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The variable first is set to null. D. The variable first is set to elements[0]. Solution : D String 배열인 elements 는 총 3개의 방에 각각 값이 들어가 있으며 , length또한 0보다 크다 , 고로 elements[0] 만약 elements.length ..