반응형
자격증/OCJP_ExamC2018. 7. 20. 00:02QUESTION 3

QUESTION 3 What is the result? 1. public class SimpleCalc { 2. public int value; 3. public void calculate() { value += 7; } 4. } and: 1. public class MultiCalc extends SimpleCalc { 2. public void calculate() { value -= 3; } 3. public void calculate(int multiplier) { 4. calculate(); 5. super.calculate(); 6. value *= multiplier; 7. } 8. public static void main(String[] args) { 9. MultiCalc calcula..

자격증/OCJP_ExamC2018. 7. 19. 23:50QUESTION 2

QUESTION 2 Given: 1. interface A { public void aMethod(); } 2. interface B { public void bMethod(); } 3. interface C extends A,B { public void cMethod(); } 4. class D implements B { 5. public void bMethod(){} 6. } 7. class E extends D implements C { 8. public void aMethod(){} 9. public void bMethod(){} 10. public void cMethod(){} 11. } What is the result? A. Compilation fails because of an error..

자격증/OCJP_ExamC2018. 7. 19. 23:34QUESTION 1

QUESTION 1 Given: 11. String test = "Test A. Test B. Test C.";12. // insert code here 13. String[] result = test.split(regex); Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"? A. String regex = "";B. String regex = " "; C. String regex = ".*"; D. String regex = "\\s"; E. String regex = "\\.\\s*"; F. String regex = "\\w[ \.] +"; Solution ..

자격증/OCJP_ExamB2018. 7. 13. 23:24QUESTION 60

QUESTION 60 Given: 3. import java.util.*; 4. public class Hancock { 5. // insert code here 6. list.add("foo"); 7. } 8. } Which two code fragments, inserted independently at line 5, will compile without warnings? (Choose two.) A. public void addStrings(List list) { B. public void addStrings(List list) { C. public void addStrings(List list) { D. public void addStrings(List list) { Solution : BC

자격증/OCJP_ExamB2018. 7. 13. 23:20QUESTION 59

QUESTION 59 Given: int x = 0;int y = 10; do { y--; ++x;} while (x

자격증/OCJP_ExamB2018. 7. 13. 22:03QUESTION 58

QUESTION 58 Given: 11. public class Test { 12. public static void main(String [] args) { 13. int x = 5; 14. boolean b1 = true; 15. boolean b2 = false; 16. 17. if ((x == 4) && !b2 ) 18. System.out.print("1 "); 19. System.out.print("2 "); 20. if ((b2 = true) && b1 ) 21. System.out.print("3 "); 22. } 23. } What is the result? A. 2 B. 3 C. 1 2 D. 2 3 E. 1 2 3 F. Compilation fails. G. An exception is..

반응형
image