Pre-requisite - Post#167 Understanding API
Java API contains predefined functions which help us in using the predefined functions instead of writing the code from scratch. All the predefined functions are categorized by Classes and all the Classes are categorized by packages. Please view the below screen to understand the architecture of Java API -
Lets find the Java predefined method max( ) to understand the architecture of Java API as shown below -
1. Open any Browser and navigate to http://docs.oracle.com/javase as shown below -
2. Go to Program Files folder in your computer and find out the version of Java (JRE or JDK) that you have installed on your machine as shown below - (Version 8 is installed in my system)
3.In the browser page of first step, select the version of Java Installed on your machine as shown below - (I have selected version 8)
4. Observe that the selected version page is displayed as shown below -
5. In the page, select the 'Java SE Documentation' as shown below -
6. Observe that 'Java Standard Edition 8 API Specification' page is displayed as shown below -
7. In order to find the predefined method max( ), we have to first find its package name java.language in the packages section and select it as shown below -
8. Observe that java.lang package specific Classes and Interfaces are displayed as shown below -
9. As the predefined method max( ) belongs to Math Class, select Math Class from the java.lang package specific Classes section as shown below -
10. Observe that Class Math page is displayed as shown below -
11. In order to find out the predefined methods in Math Class, select 'METHOD' option on the Class Math page as shown below -
12. Observe that 'Method Summary' page is displayed with 'All Methods' tab selected by default as shown below -
13. Out of all the predefined method of Math Class, find the max( ) predefined method as shown below -
14. Select the max( ) predefined method and observe that the details of the max( ) predefined method are displayed as shown below -
So, Java API is a collection of packages, packages have their own set of Classes and Class have their own set of Predefined methods. So in the above example, the path to access the max( ) predefined method is
In the similar manner in Java API, you can find the other predefined methods in the same way by finding their package and Class names.
Believing that you have understood the Java API, I would like to explain how Java API is implemented in Eclipse IDE in the next post.
Please comment below to feedback or ask questions.