Home >Java >JavaBase >What does api mean in java

What does api mean in java

王林
王林Original
2019-11-15 09:51:016182browse

What does api mean in java

API Concept

API (Application Programming Interface): Application Programming Interface.

Example:

Write a robot program to control the robot to play football. The program needs to send commands to the robot such as running forward, running backward, shooting, grabbing the ball, etc. This kind of command is difficult for people who have never programmed to imagine how to write such a program. But for experienced developers, they know that robot manufacturers will definitely provide some Java classes for controlling robots. These classes define methods for operating various robot actions.

In fact, these Java classes are the interfaces provided by robot manufacturers for application programming. We call these classes API.

Steps to quickly use the API:

A: Open the help document

B: Click Show, find the index, and see the input box

C: Just enter what you want to learn in the box

Example: Random

D: Look at the classes under the package

java.lang There is no need to import the package when using it

E: Look at the description of the class

Random class is a class used to generate random numbers

F: Look at the construction method

Random(): No-argument construction method

Random r = new Random();

G: See member method

public int nextInt(int n): What is generated is [0,n )Random numbers within the range

Calling method:

Look at the return value type: whatever type they return, you use what type to receive

Look at the method name: don’t write the name Wrong

Look at the formal parameters: if someone wants a few parameters, give them a few, and give them whatever data type they want

int number = r.nextInt(100);

Recommended tutorial: Java Tutorial

The above is the detailed content of What does api mean in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more