Java

Cannot make a static reference to the non-static method getClass() from the type Object

sstdio.h·2015년 4월 1일·조회 5,874

 

getClass() 를 오류 없이 사용하고 있었는데 해당 클래스를 static 으로 변경했더니 아래와 같이 오류가 발생. 

Cannot make a static reference to the non-static method getClass() from the type Object

< 해결책 >

getClass() -> Class명.class

예) getClass().getClassLoader() -> Test.class.getClassLoader()

댓글 0

로그인 후 댓글을 남길 수 있습니다.

아직 댓글이 없습니다.