반응형
자격증/OCJP_ExamA2018. 7. 1. 00:54QUESTION 29

22. StringBuilder sb1 = new StringBuilder("123"); 23. String s1 = "123"; 24. // insert code here 25. System.out.println(sb1 + " " + s1); Which code fragment, inserted at line 24, outputs 123abc 123abc? A. sb1.append("abc"); s1.append("abc"); B. sb1.append("abc"); s1.concat("abc"); C. sb1.concat("abc"); s1.append("abc"); D. sb1.concat("abc"); s1.concat("abc"); E. sb1.append("abc"); s1 = s1.concat..

자격증/OCJP_ExamA2018. 7. 1. 00:46QUESTION 28

Given: 1. public class Score implements Comparable { 2. private int wins, losses; 3. public Score(int w, int l) { wins = w; losses = l; } 4. public int getWins() { return wins; } 5. public int getLosses() { return losses; } 6. public String toString() { 7. return ""; 8. } 9. // insert code here 10. } Which method will complete this class? A. public int compareTo(Object o){/*more code here*/} B. ..

자격증/OCJP_ExamA2018. 7. 1. 00:36QUESTION 27

Given that the current directory is empty, and that the user has read and write permissions, and the following: 1. import java.io.*; 2. public class DOS { 3. public static void main(String[] args) { 4. File dir = new File("dir"); 5. dir.mkdir(); 6. File f1 = new File(dir, "f1.txt"); 7. try { 8. f1.createNewFile(); 9. } catch (IOException e) { ; } 10. File newDir = new File("newDir"); 11. dir.ren..

반응형
image