반응형
자격증/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_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..

자격증/OCJP_ExamC2018. 7. 25. 01:16QUESTION 39

QUESTION 39 Given: 11. public class Commander { 12. public static void main(String[] args) { 13. String myProp = /* insert code here */ 14. System.out.println(myProp); 15. } 16. } and the command line: java -Dprop.custom=gobstopper Commander Which two, placed on line 13, will produce the output gobstopper? (Choose two.) A. System.load("prop.custom"); B. System.getenv("prop.custom"); C. System.pr..

자격증/OCJP_ExamC2018. 7. 25. 01:12QUESTION 38

QUESTION 38 Given: interface Animal { void makeNoise(); } class Horse implements Animal { Long weight = 1200L; public void makeNoise() { System.out.println("whinny"); } } 01. public class Icelandic extends Horse { 02. public void makeNoise() { 03. System.out.println("vinny"); 04. } 05. 06. public static void main(String[] args) { 07. Icelandic i1 = new Icelandic(); 08. Icelandic i2 = new Iceland..

자격증/OCJP_ExamC2018. 7. 25. 00:57QUESTION 37

QUESTION 37 Given: 04. public class Tahiti { 05. Tahiti t; 06. 07. public static void main(String[] args) { 08. Tahiti t = new Tahiti(); 09. Tahiti t2 = t.go(t); 10. t2 = null; 11. // more code here 12. } 13. 14. Tahiti go(Tahiti t) { 15. Tahiti t1 = new Tahiti(); 16. Tahiti t2 = new Tahiti(); 17. t1.t = t2; 18. t2.t = t1; 19. t.t = t2; 20. return t1; 21. } 22. } When line 11 is reached, how man..

반응형
image