This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "default package related query" Watch "default package related query" New topic

default package related query

Poorvika Chandra

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

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

Joined: Sep 20, 2010
Posts: 3370
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.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36478
And welcome to the Ranch
Poorvika Chandra

Joined: Jun 27, 2011
Posts: 3
I agree. Here's the link:
subject: default package related query
Similar Threads
integer literals
enum constructors
WA #2 ..... word association
body-content default?
what's the default action method for struts' html:form ?