QUESTION 48자격증/OCJP_ExamB2018. 7. 13. 19:55
Table of Contents
반응형
QUESTION 48Given:1. public class TestString3 {2. public static void main(String[] args) {3. // insert code here4.5. System.out.println(s);6. }7. }Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.)A. String s = "123456789"; s = (s-"123").replace(1,3,"24") - "89";B. StringBuffer s = new StringBuffer("123456789"); s.delete(0,3).replace(1,3,"24").delete(4,6);C. StringBuffer s = new StringBuffer("123456789"); s.substring(3,6).delete(1,3).insert(1, "24");D. StringBuilder s = new StringBuilder("123456789"); s.substring(3,6).delete(1,2).insert(1, "24");E. StringBuilder s = new StringBuilder("123456789"); s.delete(0,3).delete(1,3).delete(2,5).insert(1, "24");Solution : BE
plus imformation
StringBuffer Delete : delete(a,b) --> a~b-1 까지 삭제
StringBuffer replace : replace(a,b,"replace") --> a~b-1 index값을 replace로 바꾼다.
반응형
'자격증 > OCJP_ExamB' 카테고리의 다른 글
QUESTION 50 (0) | 2018.07.13 |
---|---|
QUESTION 49 (0) | 2018.07.13 |
QUESTION 47 (0) | 2018.07.13 |
QUESTION 46 (0) | 2018.07.13 |
QUESTION 45 (0) | 2018.07.13 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상