되어 주 (기본값)에서 다른를 자바 프로그램의 진입 점을 변경할 수 있습니까? 내가 코드를자바 진입 점
public class TestWithoutMain {
static {
System.out.println("hello bristy!!!");
}
}
를 작성하는 경우
나는 이클립스에서 코드를 실행할 수 없습니다입니다. 내가 위의 코드에 main 메소드를 추가하는 경우
public class TestWithoutMain {
static {
System.out.println("hello bristy!!!");
}
public static void main(String[] args) {
}
}
이 헬로 bristy를 인쇄!.
왜이 작업을 수행 하시겠습니까? –
주 기능의 핵심은 'static {...}'블록이 아니라 코드를 넣는 것입니다. –
[java 프로그램의 진입 점으로 다른 정적 메소드가 있습니까?] (http : /stackoverflow.com/questions/2472506/having-another-static-method-as-the-entry-point-of-the-java-program) –