0 votes
in JAVA by
What is the package?

1 Answer

0 votes
by

A package is a group of similar type of classes, interfaces, and sub-packages. It provides access protection and removes naming collision. The packages in Java can be categorized into two forms, inbuilt package, and user-defined package. There are many built-in packages such as Java, lang, awt, javax, swing, net, io, util, sql, etc. Consider the following example to create a package in Java.

//save as Simple.java  

package mypack;  

public class Simple{  

 public static void main(String args[]){  

    System.out.println("Welcome to package");  

   }  

}  

Related questions

0 votes
asked Jul 2, 2023 in JAVA by rajeshsharma
0 votes
asked Jul 1, 2023 in JAVA by sharadyadav1986
...