API (Application Programming Interface, Application Programming Interface) is a set of predefined functions that provide applications and developers with access to a set of routines based on certain software or hardware. capabilities without having to access the source code or understand the details of the inner workings.
Introduction
When running a Java program, the virtual machine loads the Java API class file used by the program's class file. 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. Precisely because the Java virtual machine and Java API are explicitly implemented on each specific host platform, Java programs themselves can become platform-independent programs.
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.
php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!
The above is the detailed content of what is java api. For more information, please follow other related articles on the PHP Chinese website!