• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Acess Class in Default package!!!

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • 0
  • 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: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 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
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic