J2 SE 1.4 이후론 Default Package에 대한 접근이 불가.
(여러 글에서 스펙에 나와있다 하였으나 정확하게 파악하지는 못한상태.)

다음과 같은 방법으로 가능은 함.;


 Class fooClass = Class.forName("FooBar");
 Method fooMethod = fooClass.getMethod("fooMethod", new Class[] { String.class });

String fooReturned =
      fooMethod.invoke(fooClass.newInstance(), new String[] { "I did it"}).toString();

출처.



뭐 여튼 한가지 배웠으니 :)


# 추가.

Sun 홈페이지에서 다음과 같은 문서 발견.



160 페이지에 보면

 It is a compile time error to import a type from the unnamed package



라는 문구..


unnamed package = default package 



찾았다.. 하악하악;

+ Recent posts