반응형
자격증/OCJP_ExamA2018. 7. 8. 19:36QUESTION 51

QUESTION 51 Given two files: GrizzlyBear.java and Salmon.java 1. package animals.mammals; 2. 3. public class GrizzlyBear extends Bear { 4. void hunt() { 5. Salmon s = findSalmon(); 6. s.consume(); 7. } 8. } 1. package animals.fish; 2. 3. public class Salmon extends Fish { 4. public void consume() { /* do stuff */ } 5. } If both classes are in the correct directories for their packages, and the M..

자격증/OCJP_ExamA2018. 7. 8. 19:18QUESTION 50

QUESTION 50 Given: 1. interface Animal { void makeNoise(); } 2. class Horse implements Animal { 3. Long weight = 1200L; 4. public void makeNoise() { System.out.println("whinny"); } 5. } 6. 7. public class Icelandic extends Horse { 8. public void makeNoise() { System.out.println("vinny"); } 9. public static void main(String[] args) { 10. Icelandic i1 = new Icelandic(); 11. Icelandic i2 = new Icel..

자격증/OCJP_ExamA2018. 7. 8. 19:14QUESTION 49

QUESTION 49 Given: 1. public class Pass { 2. public static void main(String [] args) { 3. int x = 5; 4. Pass p = new Pass(); 5. p.doStuff(x); 6. System.out.print(" main x = " + x); 7. } 8. 9. void doStuff(int x) { 10. System.out.print(" doStuff x = " + x++); 11. } 12. } What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. doStuff x = 6 main x = 6 D. doStuff x = 5 ma..

자격증/OCJP_ExamA2018. 7. 8. 19:08QUESTION 48

QUESTION 48 Given: public class Yippee { public static void main(String [] args) { for(int x = 1; x < args.length; x++) { System.out.print(args[x] + " "); } } } and two separate command line invocations: java Yippee java Yippee 1 2 3 4 What is the result? A. No output is produced. 1 2 3 B. No output is produced. 2 3 4 C. No output is produced. 1 2 3 4 D. An exception is thrown at runtime. 1 2 3 ..

자격증/OCJP_ExamA2018. 7. 8. 19:00QUESTION 47

QUESTION 47 Given: 1. public class Batman { 2. int squares = 81; 3. public static void main(String[] args) { 4. new Batman().go(); 5. } 6. void go() { 7. incr(++squares); 8. System.out.println(squares); 9. } 10. void incr(int squares) { squares += 10; } 11. } What is the result? A. 81 B. 82 C. 91 D. 92 E. Compilation fails. F. An exception is thrown at runtime Solution : B Plus imformation : 정사각..

자격증/OCJP_ExamA2018. 7. 8. 18:44QUESTION 46

QUESTION 46 Which statement is true? A. A class's finalize() method CANNOT be invoked explicitly. B. super.finalize() is called implicitly by any overriding finalize() method. C. The finalize() method for a given object is called no more than once by the garbage collector. D. The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable...

반응형
image