What is API?
API (Application Programming Interface, Application Programming Interface) is a set of predefined functions that are designed to provide applications and developers with the ability to access a set of routines based on certain software or hardware without requiring Access the source code, or understand the details of the inner workings.
JAVA API package
Example:
java.lang
The package contains the Java programming language The most basic class. Since the java.lang package is the most frequently used package in Java programming, Java automatically imports the java.lang package for every Java source program by default, and programmers no longer have to explicitly import it manually.
Online learning video tutorial sharing: java learning
Object
class:
The Object class is the root of the entire Java class hierarchy Class, all other classes in Java are directly or indirectly inherited (derived) from the Object class.
Only some methods are defined in the Object class, but no properties are defined.
The Object class implements object runtime-related methods, garbage collection methods, and thread synchronization methods.
Commonly used methods of the Object class Example 1:
equals()
Method:
public boolean equals(Object obj)
Purpose: Compare two objects for equality.
Input parameters: obj-the reference object for comparison.
Return value: true if the value of the object is the same as the obj parameter; otherwise false
Common methods of the Object class Example 2:
toString()
Method:
public String toString()
Purpose: Generally returns a string representing this object as text. The results are given in a short and concise representation so that they are easy for humans to read.
Input parameters: None
Return value: A string representing this object.
Recommended related articles and tutorials: java introductory tutorial
The above is the detailed content of what is api in java. For more information, please follow other related articles on the PHP Chinese website!