반응형
자격증/OCJP_ExamB2018. 7. 10. 22:49QUESTION 35

QUESTION 35 Which three code fragments, added individually at line 29, produce the output 100? (Choose three.) 10. class Inner { 11. private int x; 12. public void setX( int x ){ this.x = x; } 13. public int getX(){ return x;} 14. } 15. 16. class Outer { 17. private Inner y; 18. public void setY( Inner y ){ this.y = y; } 19. public Inner getY() { return y; } 20. } 21. 22. public class Gamma { 23..

자격증/OCJP_ExamB2018. 7. 10. 22:42QUESTION 34

QUESTION 34 Given classes defined in two different files: 1. package util; 2. public class BitUtils { 3. public static void process(byte[] b) { /* more code here */ } 4. } 1. package app; 2. public class SomeApp { 3. public static void main(String[] args) { 4. byte[] bytes = new byte[256]; 5. // insert code here 6. } 7. } What is required at line 5 in class SomeApp to use the process method of B..

자격증/OCJP_ExamB2018. 7. 10. 17:50QUESTION 32

QUESTION 32 Given 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? (Choose three.) A. final B. static C. native D. public E. private F. abstract G. protected Solution : ABD plus imformation C : 자바에서 지원하는 다른 언어와의 연동이 가능하게 해주는 메소드F : 추상화 클래스를 만들 때 사용

자격증/OCJP_ExamB2018. 7. 10. 17:38QUESTION 31

QUESTION 31 Given: 09. class Line { 10. public static class Point {} 11. } 12. 13. class Triangle { 14. public Triangle(){ 15. // insert code here 16. } 17. } Which code, inserted at line 15, creates an instance of the Point class defined in Line? A. Point p = new Point(); B. Line.Point p = new Line.Point(); C. The Point class cannot be instatiated at line 15. D. Line l = new Line() ; l.Point p ..

자격증/OCJP_ExamB2018. 7. 10. 17:33QUESTION 30

QUESTION 30 Given the following six method names: addListener addMouseListener setMouseListener deleteMouseListener removeMouseListener registerMouseListener How many of these method names follow JavaBean Listener naming rules? A. 1 B. 2 C. 3 D. 4 E. 5 Solution : B plus imformation Known to me naming rules of listeners are: - Method used to register a listener with an event source must use "add"..

자격증/OCJP_ExamB2018. 7. 10. 17:24QUESTION 29

QUESTION 29 Given: 11. public enum Title { 12. MR("Mr."), MRS("Mrs."), MS("Ms."); 13. private final String title; 14. private Title(String t) { title = t; } 15. public String format(String last, String first) { 16. return title + " " + first + " " + last; 17. } 18. } 19. 20. public static void main(String[] args) { 21. System.out.println(Title.MR.format("Doe", "John")); 22. } What is the result?..

반응형
image