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.
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.
if you want to import the whole package in the program, you can use asterisk (‘*’) followed by the 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.
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
Login/Signup to comment