728x90 Java Array3 [JAVA] ch06-10. 배열 (Array) 10 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.. JAVA/예제 2017. 8. 22. [JAVA] ch06-06. 배열 (Array) 6 public class Ex06 { public static void main(String[] args){ int[] number = new int[10]; int[] counter = new int[10]; for(int i=0; i JAVA/예제 2017. 8. 22. [JAVA] ch06-02. 배열 (Array) 2 public class Ex02 { // 최대값 최소값 구하기 public static void main(String[] args){ // 가독성, 확장성(유지보수)이 좋다. int[] score = {79, 88, 91, 33, 100, 55, 95}; int max = score[0]; int min = score[0]; for(int i=1; i max) max = score[i]; if(score[i] < min) min = score[i]; } System.out.println("max: "+max+", min: "+min); } } // length JAVA/예제 2017. 8. 22. 이전 1 다음 728x90