객체 기반 배열(day09)

3539 단어 Java#공부
객체 클래스
public class Study {
	String name;
}
대상 기반 그룹의 값과 반복
		Study[] stu;
		stu = new Study[6];
		String[] name = {"111","222","333","444","555","666"};
		// for 
		for(int x = 0; x<stu.length;x++)
		{
			Study person = new Study();
			if(x<name.length)
				person.name = name[x];
			stu[x] = person;
		}
		// , 
		for (Study per : stu )
		{
			System.out.println(per.name);
		}
by 2019년 10월 24일

좋은 웹페이지 즐겨찾기