Util Package in Java

Util package in Java

In this article we will be discussing about util package in Java.

Java provides various built-in and predefined packages. These built in packages contains various classes and functionalities for users ease.

 

Util Package in Java

Java Util Package

util package in java is the widely used package in java over the years, to load all the classes and functionalities of a package, we need to use the “import” keyword. This “import” keyword helps to load all the classes of the package in the program.

If you want to import some particular class in the program of util package, you can just import the class by using its name followed by the package name.

Syntax:

import java.package_name.class_name;

if you want to import the whole package in the program, you can use asterisk (‘*’) followed by the package name.

Syntax:

import java.package_name.*;

Example to Load the whole package and a class of util.

// It loads the whole package in the program
import java.util*;

// It loads the Scanner class in the program
import java.util.Scanner;    

Java Collection Framework:

Collection Framework in java is a special type of java util package. It consist of various in-built and pre-defined methods and classes A collections framework is a single architecture that represents and controls collections, allowing for independent manipulation of collections regardless of implementation specifics. 

Advantages of Collection Framework:

  • It Provides all data structures and algorithms so that you don’t have to develop them yourself and this can reduce the amount of programming work required.
  • It Provides high-performance data structure and algorithm implementations to boost performance.
  • The Programs can be adjusted by varying implementations since the multiple implementations of each interface are interchangeable.
  • It reduces the time spent learning APIs by requiring you to become familiar with several ad hoc collection APIs.
  • It Provides a uniform interface for collections and methods to manipulate them, promoting programme reuse.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription