Java package tutorial4/8/2024 For example, java.lang, java.util, java.io, etc. - this is a SQL Date used for the SQL query and such.īased on whether the package is defined by the user or not, packages are divided into two categories: Built-in Packageīuilt-in packages are existing java packages that come along with the JDK. ![]() - this is a normal Date class that can be used anywhere.This was possible because these two Date classes belong to two different packages: 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).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |