+ 2
Why package import in java?
class is define than output is occurred so why use package?
1 Réponse
+ 11
Package are used in Java, in-order to avoid name conflicts and to control access of class, interface and enumeration etc. A package is a group of similar types of classes, interface, enumeration and sub-package. Using package it becomes easier to locate the related classes.
To get a better understanding on why we import package, go through this article :
http://beginnersbook.com/2013/03/packages-in-java/
P.S. It's mandatory to import package when dealing with sub-packages, classes or interfaces. They're not pre-built in Java.