Packages are used in Java for organizing your class files. It can be considered as different folders to organize your files within your file system. You can put related class files together in one package. Java groups predefined classes into different packages like java.lang, java.util, java.io etc.
To access a class or method from another package we need to either use the fully qualified name (e.g. com.javajee.MyClass) or we can use the import statements.
Using import statement
You can use an import statement to import a single class (import java.util.List;) or all classes of a package (import java.util.*;). Remember that you can import only types (classes and interfaces, but not methods) using a regular import.
This is a quick summary of important keywords and reserved words that you should not be using as an identifier. Identifier is a name given to any class, method, interface, enum or variable that we create. There is also added quick notes section with few important keywords that may be useful for exam or interview preparations.
This is a personal technical blog where we share our understanding on various concepts and is neither an official page or documentation for the products described here, nor the official views of the companies we work with.
Keywords used in this website are trademarks of their respective owners. This website is not affiliated with Oracle™ and/or any of the JEE frameworks like Spring™, Struts™, Hibernate™ and JSF™.
All contents and materials are provided freely without any warranty or liability and nothing within the site should be considered as professional advice. In any doubt, please ask, and we will try to help you based on our knowledge. Please let us know if you feel anything is not right here (including any copyright violation) and we will act upon it as fast as we can.