Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (55.6k points)
Can anyone explain Java API with an example?

1 Answer

0 votes
by (119k points)

Java API(application package interface) is a collection of predefined classes and packages. These Java APIs are part of java development kits like Android, OpenJDK, and Oracle.

We have to use the import keyword to import the whole package from Java API.

Example

// import whole package

import java.util.*; 

If you want to use a particular class from the package of Java API

Example

// import Vector class from util package

import java.util.Vector;

Here java.util is a package and Vector is a class from util package

I would suggest this Java Certification program by Intellipaat in case you are interested in Java.

You can watch this video on the Java tutorial for beginners:

Related questions

0 votes
1 answer
asked Nov 12, 2019 in Java by Anvi (10.2k points)
0 votes
1 answer
asked Feb 25, 2021 in Java by dante07 (13.1k points)
0 votes
0 answers
asked Jun 24, 2021 in Java by Harsh (1.5k points)
0 votes
1 answer
asked Aug 25, 2019 in Java by Shubham (3.9k points)

Browse Categories

...