Welcome back to Java Code Online. Java Package is a very convenient way of grouping similar classes, or classes having similar functionality. Java is a pile of classes, innumerable if you go on reading one by one. It would be impossible to remember every class, just by the name of the class. So what Java does is that group them together into packages.
Java consists of many packages, each serving some or the other functionality. Whenever you need to use some particular class from a package, you need to import the package. There is another way though, you can use the complete name of the class including the package name every time you need to use that class. But believe me, that is truly ridiculous. It is always better to import the package in which the class is present.
For example you need the ArrayList class, then there are two ways of using this class in your java code. They are:-
1. import java.util.ArrayList;
2. java.util.ArrayList al = new java.util.ArrayList();
The first way is the normal and regular way of importing a Java Package in a Java Class. If you do not want to go by the first way, then there is a more tedious way of doing the same thing. The second way demonstrates this thing, here you use the full qualified name of the class required. The problem with this second way is that, here every time you need to use the full qualified name of the Java Class required. That is a bit more tiring as compared to the first and easier way of importing the package once, and that's all that is required.
So now you must have a good understanding about Java Package. If you like the article then do leave a comment and keep learning Java at Java Code Online.