Chapter 5. 배열과 문자열
1. 1차원 배열 배열 선언 및 생성 자료형[] 배열명 = new 자료형[배열의 크기]; 또는 자료형 배열명[] = new 자료형[배열의 크기]; int[] score; //배열명을 score를 선언한다. int score[]라고 해도 된다. score = new int[5] // 배열 score 공갼 5개를 실제로 만든다. 배열 초기화 int[] score = {90, 85, 92, 75, 88}; int[] score = new int[]{90, 85, 92, 75, 88}; 잘못된 초기화 int[] scroe; socre = {90, 85, 92, 75, 88}; //에러 올바른 초기화 int[] score; score = new int[] {90, 85, 92, 75, 88}; 배열 출력하기 pu..
2022. 10. 23.