• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Acess Class in Default package!!!

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi How could one acess class created in default pakage...


for eg I have a class A created in a default package .. now I want to access its member from a class B which is in some other pakcage..

Thanks
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cant.
It is a compile time error to import a type from the unnamed package.

http://docs.oracle.com/javase/specs/jls/se5.0/html/packages.html
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:You cant.
Which is one reason why you should never put classes in the default package.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic