Java Packages & API
A bundle in Java is utilized to amass related classes. Consider it a envelope in a document directory. We use bundles to maintain a strategic distance from name clashes, and to compose a superior viable code. Bundles are isolated into two categories:
- Built-in Packages (bundles from the Java API)
- User-characterized Packages (make your very own packages)
The Java API is a library of prewritten classes, that are allowed to utilize, incorporated into the Java Development Environment.
The library contains segments for overseeing input, database programming, and a whole lot more. The total rundown can be found at Oracles site: https://docs.oracle.com/javase/8/docs/programming interface/.
The library is partitioned into packages and classes. Which means you can either import a solitary class (alongside its strategies and qualities), or an entire bundle that contain every one of the classes that have a place with the predetermined package.
To utilize a class or a bundle from the library, you have to utilize the
Import a Class
If you discover a class you need to use, for instance, the
Scanner class, which is utilized to get
client input, compose the accompanying code:
In the precedent above,
java.util is a bundle, while
Scanner is a class of
To utilize the
Scanner class, make an object of the class and utilize any of the accessible strategies found in the
Scanner class documentation.
In our precedent, we will utilize the
nextLine() strategy, which is utilized to peruse a