Computer Science, asked by naiksamikshya, 1 year ago

What is the use of * in import .java.util.*;

Answers

Answered by Tarteel
5

“import” is a key word that tells the compiler to invoke a certain package. Well if you are using classes from util package then you need to import util unlike lang package which is by default imported. If you do not wish to write 'import.Java.util.*' in that case you can use static import.

Answered by kavatch
1

The import statement in Java allows to refer to classes which are declared in other packages to be accessed without referring to the full package name. You do not need any import statement if you are willing to always refer to java.util.List by its full name, and so on for all other classes.

Similar questions