백터 =================
Vector v = new Vector();
v.add("윤선재");
v.add("놀다");
for(int i=0; i<v.size();i++){
System.out.print(v.get(i)+" ");
}
리스트 =================
ArrayList list = new ArrayList();
MemberBean bean = new MemberBean();
bean.setId("superman");
bean.setName("슈퍼맨");
list.add(bean);
bean = new MemberBean();
bean.setId("choi");
bean.setName("최불암");
list.add(bean);
for( int i=0; i<list.size();i++ ){
MemberBean outBean = (MemberBean)list.get(i);
System.out.print(outBean.getId()+" "+outBean.getName()+"\n");
}
해시맵 =================
Hashtable ht = new Hashtable();
ht.put("게임","스타크래프트");
ht.put("취미","잠자기");
ht.put("영화","DVD");
// System.out.println(ht.get("게임"));
// System.out.println(ht.get("취미"));
// System.out.println(ht.get("영화"));
Iterator iter = ht.keySet().iterator();
while( iter.hasNext() ){
String key = (String)iter.next();
System.out.print(key+"-");
System.out.print(ht.get(key)+"\n");
}
'프로그래밍 > JAVA' 카테고리의 다른 글
자바 개발환경 및 이클립스 설정 (0) | 2012.01.02 |
---|---|
JDBC 종류 및 처리단계 (0) | 2012.01.02 |