Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Java by (9.5k points)
reopened by
Can anyone let me know what does java.util.* mean?

3 Answers

0 votes
by (19.7k points)

Java.util.* is a built-in package in Java which encapsulates a similar group of classes, sub-packages and interfaces. The * lets you import a class from existing packages and use it in the program as many times you need. 

You can find the list of all classes, interfaces, exceptions in the official document. 

However, you are using only a few classes from the java.util package like below import java.util.ArrayList;

import java.util.LinkedList;

   It’s better to specify them individually instead of importing the whole package as java.util.*

 

0 votes
by (2.6k points)
edited by

java.util.* is an import statement with the help of which we can import all the public classes as well as interfaces in the util package in one go and the major advantage is that we don’t have to import all the public classes and interfaces individually.

Syntax→ import java.util.*

0 votes
by (2.7k points)

java.util.* is a package in Java that includes a variety of utility classes such as collections(e.g., list, maps), date and time handling, and other useful methods. The * is a wildcard that imports all classes from the java.util package.

For example, using import java.util.*; allows you to use classes like ArrayList, HashMap, and Date without needing to import each one individually

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jan 24, 2021 in Java by dante07 (13.1k points)
0 votes
4 answers

1.4k questions

32.9k answers

507 comments

693 users

...