File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Acess Class in Default package!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Acess Class in Default package!!!" Watch "Acess Class in Default package!!!" New topic

Acess Class in Default package!!!

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1283

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..


No Kaustubh No Fun, Know Kaustubh Know Fun..
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10828

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

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

Maneesh Godbole wrote:You cant.
Which is one reason why you should never put classes in the default package.

I agree. Here's the link:
subject: Acess Class in Default package!!!
It's not a secret anymore!