728x90
public class Ex10 {
public static void main(String[] args){
char[] abc = {'A','B','C','D'};
char[] number = {'0','1','2','3','4','5','6','7','8','9'};
System.out.println(new String(abc));
System.out.println(new String(number));
char[] result = new char[abc.length+number.length];
System.arraycopy(abc, 0, result, 0, abc.length);//abc의 0번째부터 abc length만큼 result 0번에다가 붙여넣기
System.arraycopy(number, 0, result, abc.length, number.length);
System.out.println(new String(result));
System.arraycopy(abc, 0, number, 0, abc.length);
System.out.println(new String(number));
}
}
728x90
'JAVA > 예제' 카테고리의 다른 글
[JAVA] ch07-02. 객체 지향 2 (0) | 2017.08.22 |
---|---|
[JAVA] ch07-01. 객체 지향 (0) | 2017.08.22 |
[JAVA] ch06-09. 배열 (Array) 9 (0) | 2017.08.22 |
[JAVA] ch06-08. 배열 (Array) 8 (0) | 2017.08.22 |
[JAVA] ch06-07. 배열 (Array) 7 (0) | 2017.08.22 |
댓글