Array
๋ฐฐ์ด
๋
๊ฐ
๊ฑธ
์ท
๋ชจ
package sec03.chap08;
public class Ex01 {
public static void main(String[] args) {
// ๐ก ์ฌ์ฉํ ์๋ฃํ ๋ค์ []๋ฅผ ๋ถ์ฌ ์ ์ธ
char[] yutnori = {'๋', '๊ฐ', '๊ฑธ', '์ท', '๋ชจ'};
//char[] yutnori = new char[];
// ๐ก length : ๋ฐฐ์ด์ ๊ธธ์ด ๋ฐํ
int length = yutnori.length;
// ๐ก [] ์์ ์ธ๋ฑ์ค ์ ์๋ฅผ ๋ฃ์ด ์ ๊ทผ
// โญ 0๋ถํฐ ์์
char first = yutnori[0];
char last = yutnori[yutnori.length - 1];
}
}
์์ ์๋ฃํ primitive type vs ์ฐธ์กฐ ์๋ฃํ reference type


Last updated