+ 2

Why package import in java?

class is define than output is occurred so why use package?

31st Jul 2017, 11:06 AM
Parmar Dhaval
Parmar Dhaval - avatar
1 Odpowiedź
+ 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.
31st Jul 2017, 11:15 AM
Dev
Dev - avatar