• Post Reply Bookmark Topic Watch Topic
  • New Topic

Package  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to use contents of a package(user defined or belonginfg to java API) without using the import statement.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and welcome to the JavaRanch.

Yes if the class is in the same package that imports are not necessary. If they are in another package then you need to import them.
 
Ranch Hand
Posts: 100
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

And if you want to use them without importing the classes, you will have to specify the full class name(like java.util.List instead of just List) everywhere where you type the class name which is practically not possible.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!