aspose file tools*
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
Author

Acess Class in Default package!!!

Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1268

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


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

Joined: Jul 26, 2007
Posts: 9990
    
    7

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


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

Joined: Jan 28, 2003
Posts: 3947
    
  17

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


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Acess Class in Default package!!!
 
Similar Threads
why iam able to access defualt specifier field even within a sub-class ?
Default access
Error on K&B exercise in Chap 10...
hi default acess specifier
Private and Protected Constructors