Visit complete Java roadmap
Java Topic

Packages

Packages

A package is a namespace that mainly contains classes and interfaces. For instance, the standard class ArrayList is in the package java.util. For this class, java.util.ArrayList is called its fully qualified name because this syntax has no ambiguity. Classes in different packages can have the same name. For example, you have the two classes java.util.Date and java.sql.Date, which are different. If no package is declared in a class, its package is the default package.

To create package use this command -> javac -d directory javafilename

Visit the following resources to learn more:

More Topics

Explore related content

View All Topics
Loved by 100K+ Developers

Start Your Learning
Journey Today

Join thousands of developers who are leveling up their skills with structured roadmaps and expert guidance

No credit card required
Always free
Track your progress