반응형
자격증/OCJP_ExamD2018. 8. 5. 19:29QUESTION 29

QUESTION 29 Click the Exhibit button. 1. import java.util.*; 2. public class TestSet{ 3. enum Example {ONE, TWO, THREE } 4. public static void main(String[] args) { 5. Collection coll = new ArrayList(); 6. coll.add(Example.THREE); 7. coll.add(Example.THREE); 8. coll.add(Example.THREE); 9. coll.add(Example.TWO); 10. coll.add(Example.TWO); 11. coll.add(Example.ONE); 12. Set set = new HashSet(coll)..

자격증/OCJP_ExamD2018. 8. 5. 19:21QUESTION 28

QUESTION 28 Click the Exhibit button. 1. public class Car { 2. private int wheelCount; 3. private String vin; 4. public Car(String vin){ 5. this.vin = vin; 6. this.wheelCount = 4; 7. } 8. public String drive(){ 9. return "zoom-zoom"; 10. } 11. public String getInfo() { 12. return "VIN: " + vin + " wheels: " + wheelCount; 13. } 14. } And 1. public class MeGo extends Car { 2. public MeGo(String vi..

자격증/OCJP_ExamD2018. 8. 5. 19:13QUESTION 27

QUESTION 27 Which three statements are true? (Choose three.) A. A final method in class X can be abstract if and only if X is abstract. B. A protected method in class X can be overridden by any subclass of X. C. A private static method can be called only within other static methods in class X. D. A non-static public final method in class X can be overridden in any subclass of X. E. A public stat..

자격증/OCJP_ExamD2018. 8. 4. 17:18QUESTION 26

QUESTION 26 Given: class Pizza { java.util.ArrayList toppings; public final void addTopping(String topping) { toppings.add(topping); } public void removeTopping(String topping) { toppings.remove(topping); }} public class PepperoniPizza extends Pizza { public void addTopping(String topping) { System.out.println("Cannot add Toppings"); } public static void main(String[] args) { Pizza pizza = new P..

자격증/OCJP_ExamD2018. 8. 4. 17:03QUESTION 25

QUESTION 25 Given that: Gadget has-a Sprocket and Gadget has-a Spring and Gadget is-a Widget and Widget has-a Sprocket Which two code fragments represent these relationships? (Choose two.) A. class Widget { Sprocket s; } class Gadget extends Widget { Spring s; } B. class Widget { } class Gadget extends Widget { Spring s1; Sprocket s2; } C. class Widget { Sprocket s1; Spring s2; } class Gadget ex..

자격증/OCJP_ExamD2018. 8. 4. 16:57QUESTION 24

QUESTION 24 A team of programmers is involved in reviewing a proposed design for a new utility class. After some discussion, they realize that the current design allows other classes to access methods in the utility class that should be accessible only to methods within the utility class itself. What design issue has the team discovered? A. Tight coupling B. Low cohesion C. High cohesion D. Loos..

반응형
image