Often people ask me about the use of common Java classes, and some ask what a common class is doing. These problems are not querying the JDK API, the methods of common classes are not familiar with the situation. So, after a few thoughts, I decided to write the JDK API query user manual.
☆ Preparation Work
①, browser can surf the internet ②, English translation software (download Chinese can not be used) ③, installed JDK
☆ Download API Help
Many years ago, a warm-hearted person, the English version of the API help document translated into Chinese version, this version is jdk1.6 Chinese version. So, we can download the Chinese version on the Internet, and also can download the latest version of the English version of the comparison view. Currently there is no 1.6 Chinese version, so so far the higher is the Chinese version of 1.6.
In the Baidu search site input jdk1.6 Chinese version. Choose CHM format download, CHM for help document, query fast, easy to use. The file size is approximately 34M to 37M (please confirm size).
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/70eb71ad4a6e416eb058798a40572ef8.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Right-click Save as you want to save the location, generally I choose to exist page.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/4b8e3c8f46eb4ae89bf60f7adda08e35.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Then, go to the desktop to see, this file is. Open this file and drag out the CHM format file.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/40ffbe0da68a4af0bb55c7c12e4dcbb2.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Select the compressed Package 1 location of the file, press and hold the left not loose, and then pull to the desktop release, unzip out 2 such shape of Help file.
☆ Introduction to JDK API Help documentation
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/93b6ee0fbff64ef490b80463756fc16e_th.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Open the JDK API document, we see the upper left half of the package, the lower left part of the package is the introduction of the file, and the right side is the left-hand selection of the class description.
☆ Use JDK API query
Here we choose the scanner class as an example. First, I look for the menu item above the open API to "show" and then click on it. Then the current API becomes three columns, which can be ignored, click "Index (N)" this.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/a91b83bf5f94428cb943c009b393d7a7.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Next, enter scanner in the text box under "Enter keyword for query (W)", and then see the check scanner below, double-click it or press ENTER.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/e6fa1e7fdb874b36b0f81975adb95d28.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Pop this box
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/00d803f661174f148a77fc5a6d8ca5cb_th.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
This is asking if you want to open the scanner page and click the Show button.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/164cec1566214ac8a5fd80e472b24486.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
At this point, we see that this part of the right side is a description of common class scanner. You are also input system,math and so on.
☆api's Query description
Most people can query the interface, you can not know how to find.
So, let's first look at the top
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/bbaec3dc6a9e4c2c9732c05222608f32.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
Java.util is to say that scanner is under this package, using scanner is, need to introduce java.util.Scanner this package, then it is clear that scanner is a class, in the following structure is scanner inheritance structure. The bottom is the interface for scanner implementations. (Here I know the package name can be introduced)
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/11defa8e791e44378244699e8c611ae6.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
The following characters explain what this is for.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/7583630b132b40d594d9d5a681cb087e_th.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
A summary of the construction methods, which illustrates what types and formats each of the arguments can pass in scanner.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/aa1b758440364766afa065a6cbdf6cd7_th.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
The method summary shows that the methods provided by scanner have those that describe what the method is doing separately.
For example, look at Nextint () This method, click on it and you will see as shown
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/a968dff257fe444a8a4ef8cb2e921668.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
This is, see Nextint () before is the int type, the description returns an int type, the following return has been said quite clear. So, there's the
Scanner sc = new Scanner (system.in);//instantiation of the scanner int a = SC.NEXTLNT ();//scan an int for the save to variable a
Other methods are queried according to the type of method.
☆ Description
①, for some classes there is also a field summary, which is a description of the properties and constants of the current class.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/ea5d13472b59425eaf401d9a1de7c7a7.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
②, after some APIs are used, the desktop will generate a. CHW cache file, and after closing the API, delete the file.
650) this.width=650; "src=" Http://img.mp.itc.cn/upload/20160902/839c65733bc249a689a611e4070746bf.jpg "style=" border:0px;margin:0px;padding:0px;font-size:0px; "/>
③, for some methods can be found in the search options, here is not explained.
There was a great God said: Learning Javase, playing is the API.
Technology sharing: www.kaige123.com
This article from the "11247808" blog, reproduced please contact the author!
JDK API from download to use