반응형
자격증/OCJP_ExamD2018. 7. 26. 19:56QUESTION 2

QUESTION 2 Given: 11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println("It is " + (j == i) + " that j==i."); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12? A. It is true that j==i. B. It is false that j==i. C. An exception is thrown at runt..

자격증/OCJP_ExamD2018. 7. 26. 19:42QUESTION 1

QUESTION 1 Given: 1. public class KungFu { 2. public static void main(String[] args) { 3. Integer x = 400; 4. Integer y = x; 5. x++; 6. StringBuilder sb1 = new StringBuilder("123"); 7. StringBuilder sb2 = sb1; 8. sb1.append("5"); 9. System.out.println((x == y) + " " + (sb1 == sb2)); 10. } 11. } What is the result? A. true true B. false true C. true false D. false false E. Compilation fails. F. A..

자격증/OCJP_ExamC2018. 7. 26. 19:31QUESTION 60

QUESTION 60 Given: 1. public interface A { public void m1(); } 2. 3. class B implements A { } 4. class C implements A { public void m1() { } } 5. class D implements A { public void m1(int x) { } } 6. abstract class E implements A { } 7. abstract class F implements A { public void m1() { } } 8. abstract class G implements A { public void m1(int x) { } } What is the result? A. Compilation succeeds..

자격증/OCJP_ExamC2018. 7. 26. 19:14QUESTION 59

QUESTION 59 Given: public class Base { public static final String FOO = "foo"; public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(((Base) s).FOO); } } class Sub extends Base { public static final String FOO = "bar"; } What is the result? A. foofo..

자격증/OCJP_ExamC2018. 7. 26. 19:11QUESTION 58

QUESTION 58 Given: public static Iterator reverse(List list) { Collections.reverse(list); return list.iterator();} public static void main(String[] args) { List list = new ArrayList(); list.add("1"); list.add("2"); list.add("3"); for (Object obj: reverse(list)) System.out.print(obj + ", "); } What is the result? A. 3, 2, 1, B. 1, 2, 3, C. Compilation fails. D. The code runs with no output. E. An..

자격증/OCJP_ExamC2018. 7. 26. 19:05QUESTION 57

QUESTION 57 Given: public static Collection get() { Collection sorted = new LinkedList(); sorted.add("B"); sorted.add("C"); sorted.add("A"); return sorted;} public static void main(String[] args) { for (Object obj: get()) { System.out.print(obj + ", "); }} What is the result? A. A, B, C, B. B, C, A, C. Compilation fails. D. The code runs with no output. E. An exception is thrown at runtime. Solu..

반응형
image