![how to get core gms package how to get core gms package](https://4.bp.blogspot.com/-ACQ3V--bU4o/U1kZSjmQAXI/AAAAAAAABck/6KD3az4aEjw/s1600/Package+in+Java.gif)
Here, each level of the package is a directory in your file system. Hence, there's a convention to create a package as a domain name, but in reverse order. The package name must be unique (like a domain name). Here, the Test class now belongs to the com.test package. Here, any class that is declared within the test directory belongs to the com.test package. Now, edit Test.java file, and at the beginning of the file, write the package statement as: Let's create a Java file inside another directory. Java uses file system directories to store packages. To define a package in Java, you use the keyword package. These packages are called user-defined packages. Java also allows you to create packages as per your need. To use it, we have to import the package first using the import statement. The ArrayList class belongs to java.util package. For example, java.lang, java.util, java.io, etc.
![how to get core gms package how to get core gms package](https://www.talkingdotnet.com/wp-content/uploads/2016/04/Show-Package.json-Solution-1-.png)
![how to get core gms package how to get core gms package](https://i.stack.imgur.com/b1mRK.png)
How did they manage to include two classes with the same name Date in JDK? However, the rule of thumb in Java programming is that only one unique class name is allowed in a Java project. These packages help you to reserve the class namespace and create a maintainable code.įor example, you can find two Date classes in Java. If you want to use the ResultSet interface in your code, just import the java.sql package (Importing packages will be discussed later in the article).Īs mentioned earlier, packages are just containers for Java classes, interfaces and so on. The package contains all the related types that are needed for the SQL query and database connection. For example, in core Java, the ResultSet interface belongs to the java.sql package. A package is simply a container that groups related types (Java classes, interfaces, enumerations, and annotations).