준코딩

배열 복제 Clone 본문

프로그래밍/자바

배열 복제 Clone

Ljunhyeob - App Dev 2019. 1. 9. 15:19

package algorithm;

 

 class CloneArray {

public static void main(String[]args) {

int[] a = {1,2,3,4,5};

int[] b = a.clone();

 

b[3] = 0;

 

System.out.print("a= ");

for(int i=0; i<b.length;i++)

System.out.print(" "+a[i]);

 

System.out.print("\nb= ");

for(int i=0; i<b.length;i++)

System.out.print(" "+b[i]);

}

 

}

 

 

'프로그래밍 > 자바' 카테고리의 다른 글

자바 스택구현  (0) 2019.01.09
중앙값 구하기  (0) 2019.01.09
최대값 구하기  (0) 2019.01.09
버블정렬코드 (스택, 큐 , 정렬)  (0) 2018.12.11
BubbleSort 버블정렬  (0) 2018.12.10
Comments