일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- mybatis
- Menu
- 메서드
- 에러페이지
- Android
- 클래스
- 안드로이드
- oracle
- 예외처리
- 전화걸기
- JSP
- 이클립스
- paint
- Graphic
- 배열
- 오버로딩
- Java
- 기본
- struts2
- layout
- Eclips
- JavaScript
- 메소드
- 어노테이션
- 국제화
- OGNL
- HTML
- AWT
- 생성자
- Spring
- Today
- Total
목록자바/배열 (7)
note
public class ArrayEx12 { 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)); //배열 abc와 number를 붙여서 하나의 배열 result로 만든다. char[] result = new char[abc.length + number.length]; System.arraycopy(abc, 0, result, 0, abc.length); System.arraycopy(nu..
public class Score3 {//2차 배열로 성적 생성 public static void main(String[] args){ java.util.Scanner input=new java.util.Scanner(System.in); String[] subname = {"국어","영어","수학"}; int[][] sub = new int[3][subname.length + 1]; //0첫번째사람1두번째사람2세번째사람 float[] avg = new float[3]; //3명에 대한 각각 평균값 저장 for(int k =0; k < sub.length; k++){ for(int i = 0; i 100); sub[k][sub[k].length - 1] += sub[k][i]; //총점에다가 점수 누적 ..
public class Score2 {//Array로 성적짜기 한사람에 대한 데이터 1차배열 public static void main(String[] args){ java.util.Scanner input=new java.util.Scanner(System.in); String[] subname = {"국어","영어","수학"}; //0국어 1영어 2수학 3총합 int[] sub = new int[subname.length + 1]; float avg = 0.0f; //데이터 입력 부분 for (int i= 0; i < sub.length - 1; i++){ do{ System.out.print(subname[i] + " = "); sub[i] = input.nextInt(); } while (sub[..
public class Score {//2차원 배열로 성적 출력 public static void main(String[] args){ int[][] score = { {100,100,100}, {20,20,20}, {30,30,30}, {40,40,40}, {50,50,50} }; System.out.println("번호 국어 영어 수학 총점 평균"); System.out.println("=================="); for(int i=0; i
public class ArrayTest3 {//2차원 배열생성초기화 public static void main(String[] args){ //2차원 배열 선언, 생성, 초기화(명시적 배열생성) int[][] test = new int[][]{{100,200,300},{400,500,600}}; //{}안에 {},{} 가 두개 들어감 2차원 배열이기 때문에 //2차원 배열선언, 생성, 초기화(암시적 배열생성) int[][] test2 ={{100,200,300},{400,500,600}}; } } 출력이 없음
public class ArrayTest2 {//2차원배열 array public static void main(String[] args){ int test[][]; //2차원 배열 선언 test = new int[2][3]; //2차원 배열생성 //행 열 (개념) //2차원 배열 초기화 test[0][0] = 100; test[0][1] = 200; test[0][2] = 300; test[1][0] = 400; test[1][1] = 500; test[1][2] = 600; //2차원 배열 내용 사용 for(int i=0; i