반응형
자격증/OCJP_ExamC2018. 7. 26. 06:26QUESTION 44

QUESTION 44 Given: interface Fish { } class Perch implements Fish { } class Walleye extends Perch { } class Bluegill { } public class Fisherman { public static void main(String[] args) { Fish f = new Walleye(); Walleye w = new Walleye(); Bluegill b = new Bluegill(); if (f instanceof Perch) System.out.print("f-p "); if (w instanceof Fish) System.out.print("w-f "); if (b instanceof Fish) System.ou..

자격증/OCJP_ExamC2018. 7. 26. 06:20QUESTION 43

QUESTION 43 Given classes defined in two different files: 1. package packageA; 2. public class Message { 3. String getText() { 4. return "text"; 5. } 6. } And: 1. package packageB; 2. 3. public class XMLMessage extends packageA.Message { 4. String getText() { 5. return "text"; 6. } 7. 8. public static void main(String[] args) { 9. System.out.println(new XMLMessage().getText()); 10. } 11. } What ..

자격증/OCJP_ExamC2018. 7. 26. 06:13QUESTION 42

QUESTION 42 Click the Exhibit button. class Foo { private int x; public Foo( int x ){ this.x = x;} public void setX( int x ) { this.x = x; } public int getX(){ return x;} } public class Gamma { static Foo fooBar(Foo foo) { foo = new Foo(100); return foo; } public static void main(String[] args) { Foo foo = new Foo( 300 ); System.out.println( foo.getX() + "-"); Foo fooFoo = fooBar(foo); System.ou..

자격증/OCJP_공지사항2018. 7. 26. 06:07OCJP_공지사항

안녕하세요 . OCJP 카테고리는 제가 자세하고 깊게 내용을 다루지 않습니다.부족한 부분 or 궁금한 부분 남겨 주신다면 감사하겠습니다.

자격증/OCJP_ExamC2018. 7. 26. 06:03QUESTION 41

QUESTION 41 A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose three.) A. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar. B. The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar.. C..

자격증/OCJP_ExamC2018. 7. 25. 01:22QUESTION 40

QUESTION 40 Given: 1. public class ItemTest { 2. private final int id; 3. 4. public ItemTest(int id) { 5. this.id = id; 6. } 7. 8. public void updateId(int newId) { 9. id = newId; 10. } 11. 12. public static void main(String[] args) { 13. ItemTest fa = new ItemTest(42); 14. fa.updateId(69); 15. System.out.println(fa.id); 16. } 17. } What is the result? A. Compilation fails. B. An exception is th..

반응형
image