static 메소드에서 getClass()메소드를 호출하는 방법이 없을까요?
조회수 5794회
static메소드를 많이 만들었는데요. static메소드 내부에서 아래같이 getClass()메소드를 호출해야해요
public static void startMusic() {
URL songPath = getClass().getClassLoader().getResource("background.midi");
}
그런데 이렇게 컴파일을 하면 이클립스에서
에러메세지
Cannot make a static reference to the non-static method getClass()
from the type Object
이런 에러가 뜨는데 어떻게 호출하는 방법이 없을까요?
댓글 입력