public class Singleton{ private static Singleton sSingleton; public static Singleton get(Context context) { if (sSingleton== null) { sSingleton= new Singleton(context); } return sSingleton; } }
-향상된 for문
for(String obj : Array){
System.out.println(obj);
}
Array의 배열하나씩 obj에 대입하여 몸통(중괄호) 실행
Listmarray = new ArrayList (); for(int i =0 ;i<10;i++) //marray에 0부터 9까지 문자대입 marray.add(" "+i); for(String obj : marray){ //marray[0] 부터 marray[9]까지 obj에 대입하여 실행 System.out.println(obj); }
여러 클래스 사용가능
댓글 없음:
댓글 쓰기