프로그래밍

getinstance 앞에 static이 선언되어있다

밍딩이 2015. 7. 30. 16:41

getinstance 앞에 static이 선언되어있다 클래스.메서드 이기 때문에


추상클래스는 밖에서 객체를 못 만듬


abstract 어쩌고


상속을 받아서 사용해야 함


Calendar ca = Calendar.getInstance();



import java.util.Calendar;


public class CalTest1 {


public static void main(String[] args) {

Calendar begin = Calendar.getInstance();

//

Calendar end = Calendar.getInstance();

//4일 4시간 50분

end.set(Calendar.MINUTE, 40);

long b = begin.getTimeInMillis();

long c = end.getTimeInMillis();

long result = c-b;

System.out.println(result/(1000*60));

}





만약 피시방에서 계산을 해야한다면

이렇게 계산을 한다