my dog learned polymorphism
The moose likes Beginning Java and the fly likes default package related query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "default package related query" Watch "default package related query" New topic
Author

default package related query

Poorvika Chandra
Greenhorn

Joined: Jun 27, 2011
Posts: 3
Dear all,

As we know it is not recommended to write classes under default package.Then what might be the purpose behind the introduction of default packages in java

Regards
Poorvika
Ogeh Ikem
Ranch Hand

Joined: May 13, 2002
Posts: 180
You can compile and run a class in a default package (just like any other class). The only problem is that you cannot import the default package.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3995
    
  18

The purpose of the default package is to enable people to quickly write very small test programs or example code, without cluttering it with the package declaration.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 44031
    
  33
And welcome to the Ranch
Poorvika Chandra
Greenhorn

Joined: Jun 27, 2011
Posts: 3
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: default package related query
 
It's not a secret anymore!