Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

default package related query

 
Poorvika Chandra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 180
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6337
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 50276
80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Poorvika Chandra
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic