Home  >  Article  >  Java  >  What is API in Java?

What is API in Java?

青灯夜游
青灯夜游Original
2019-12-27 13:20:585612browse

What is API in Java?

API (Application Programming Interface, Application Programming Interface) are some predefined functions provided by java. The purpose is to provide applications and developers with access to a certain software or hardware. The ability to group routines without having to access the source code or understand the details of the inner workings.

[Recommended learning: Java video tutorial]

When running a Java program, the Java API class file used by the virtual machine to load the class file of the program. All loaded class files (including those extracted from the application and from the Java API) and all loaded dynamic libraries (including local methods) together constitute the entire program running on the Java virtual machine. Before a platform can support Java programs, the functionality of the API must be explicitly implemented on that specific platform. To access local resources on the host, the Java API calls native methods. Since the Java API class file calls native methods, the Java program does not need to call them anymore. In this way, Java API class files provide Java programs with platform-independent, standard interfaces to the underlying host. For Java programs, the Java API will have the same performance and predictable behavior regardless of the platform internals. It is precisely because the Java virtual machine and Java API are explicitly implemented on each specific host platform that the Java program itself can become a platform-independent program.

Role

The Java API also contributes to the Java security model. Before a Java API method performs any potentially dangerous operation (such as a local disk write operation), it will check whether authorization is obtained by querying the access controller. An access controller is a class that performs stack checking to determine whether an operation is allowed.

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!

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