Reading tips for Java API documentation

Source: Internet
Author: User
Tags documentation








1, the API document reading skills, first read the backbone, understand the function, in the view of foliage, English is also so

2, Java API documents reuse, as little as possible to use search, but through the directory to find, so as to help you become familiar with the target class where the specific location

3, the left side of the Big Blue is the package name, below. The columns are the classes and interfaces below the package. Packages and inheritance are not related, classes in the same package can have subclasses, or they can have parent classes.

Generally one type, such as IO, and so on, have all the classes in one package, and very few of them have packages.

Look at the API document is not difficult, the key is to have self-confidence, there is a clear purpose, there is the use of Kingsoft. And look at the example he gave. Most important. Then pay attention to accumulate your own professional vocabulary.

1, I do not recommend you to look at the API and source code verbatim, (because it is not clear what part of Java you use to develop, so the general say), if your IDE for Eclipse or MyEclipse, then in your daily development, you can see where to go (Ctrl + Click the left mouse button you want to see, so that your most commonly used API source code with the accumulation of time and accumulation, and do not have to look specifically, and this has a good directionality, in the use of the time to see, learning efficiency is also higher. If you read through the source, the first cycle is quite long, and can do not seem to many people oh.
2, if you are engaged in JEE development, if the use of a number of open source framework, it is recommended to read the framework of the source code, so that your design mode of promotion and security, such as knowledge of the understanding of the benefits.

Two years of development,
Suggest a look at Java programming ideas

API (Application Programming Interface, Application programming Interface) is a set of components that control windows (from the desktop's appearance to the memory allocated for a new process) The appearance and behavior of a set of predefined Windows functions. Each action of the user throws one or more functions running to tell windows what happened.

Do not need to give an example, as I said to do, first to find what you need, to search. And then look at its own methods, which are introduced in the method, then select a method, based on the return value and parameters to call.
As a matter of fact, the API documents look more you will know how to see and understand, this is also a lot of people do not understand the API of the heart. Leisure time to see more, try to try the inside of the property, method, you will be in front of the light. Because there are so many things you don't touch, Java profound!!!

On the left is the navigation section, there are two parts above, some of the most commonly used packages, the following is a specific class;
The right part is the specific method and some parameters that appear after you click on the specific class.
In fact, try to understand more, to be used.

I can see how much I know. How much can be used. Know the use of it. Java child package, Io,net,lang,util,sql,nio,rmi. It's under these bags. The other is not to forget. That would be a kick in the right. I only master one-tenth. It would be good to know half of it.

Java EE project, no problem. is the basics and see how little the API feels. I have a poor data structure. It's going to be the basics. Not a chance. Still have to look at the source code, understand well, it will be. To tell you the truth, there is no technical content in developing EE projects. Do the server such things, can really learn. Special data structure, design pattern, I have to. Java EE I do not give up, and then strive to learn the underlying foundation. Special data structure, design pattern. design mode, I will not much.

See the API more than one sentence
As to how to see everyone's learning method is not the same, suggested from the beginning, the general words can be read, the Internet also has Chinese, can be combined to see.

Really, even the top engineers at Sun are estimated to be less than half, do you know how to print out all the APIs using the A4 5th Word?
API is a dictionary, commonly used to remember, the other, is now used to check on the OK. As for not understand, write more code, read more code, more search API, naturally will be.





Reading tips for Java API documentation:

Java API documentation is part of the SDK documentation, a document that tells you how to use the above, and is the best helper for Java program development. When you download the SDK reference file "J2sdkˉ142ˉdoc.zip" from the Sun Microsystems Company's website http://java.sun.com/j2se/1.4.2/download.html, you can extract it in the name " J2sdkˉ142ˉdoc "in the folder below see the directory structure as shown in Figure 1ˉ3, where the text is an HTML format file, provides all the information about the API class library and links, API document content mainly includes: class hierarchy, class and its general purpose description, Member variable table, constructor table, Method table, Variable detail table, detailed description of the purpose of each variable, detailed description of construction method and further description, etc. For ease of use, we usually place the c:\j2sdkˉ142ˉdoc\docs\api\index.html in the browser's favorites for easy access.
Question 1:
Why do we use the methods in the Java API documentation directly? What are the specific implementation codes for these methods, can you look at the code?
Because that is the programming interface provided by Java.
The JDK installation folder contains the original code, Src.zip
The code in the Java API is on the JDK, and if you want to see it, you can use alt+/to see it.

Introduction to packages that are common in the Java API
The SDK provides a set of standard class libraries that provide methods and interfaces for performing most programming tasks. The class library is organized into many packages, each containing some child packages and multiple classes. A class hierarchy that forms a tree structure, including core package Jaˉva, expansion packs, javax, and org. As shown in Figure 1ˉ3. Here's a brief description of some of the important packages and their classes:
1 Java.lang ——— This package contains a number of classes that form the core of the language, providing encapsulation classes like character, integers, and double. It also provides system-standard classes, such as String and StringBuffer. The Java editor always loads this package automatically. Thus, it is generally not necessary to display any classes in the import Java.lang. Many of the classes in this package will also be described in many other chapters of this book.
2 Java.applet ——— This package provides a way to create Java applets, which are run under a Web browser and are typically downloaded over the Internet.
3 java.awt ——— is a package of classes composed of Java Abstract window tools (AWT) that provides a class-based graphical user interface that provides Windows, buttons, dialog boxes, and other controls for Java applets and application programming.
4 java.net ——— This package provides a network, socket processor, and Internet utility class.
5 java.io ——— The classes in this package provide input and output services for reading and writing file data, accessing keyboard input and printing output.
6 Java.util ——— This package contains the utility classes and the collection framework classes that are set up for the task, and each Java application and Java applet may use at least one class in this package. It also provides the collection interface and its implementation container classes, such as list and set.
7 Java.rmi ——— Remote method enabling packages, the classes in this package provide support for distributed code controlled by remote interfaces. The classes in this package allow you to create a Java application that allows different parts of it to run together in different systems.
8 java.sql ——— This package provides the implementation of a Structured Query Language database field type and method. Depending on the system, the class of this package may be implemented through a particular database system, or by default, by the ODBC (Open Database Connectivity) standard direct mapping.



On the left is all the packages. When you select a package in the package, the bottom right will display all the classes and interfaces in the package, click on the corresponding class and interface, the right side will have the corresponding class and interface details. Click on the appropriate method, you can get the appropriate method for detailed description.
There are many classes in the JDK, we don't need to learn all of them, and it doesn't matter if we need to study again. A learning path must be planned so that it is not lost in the voluminous APIs. Have knowledge of a certain field. Plus some examples, it's easy to learn the new API. Learn to use tools and resources to be good.


Learning from specific APIs
Java is involved in a wide range of areas, different areas have different APIs, no one familiar with all the APIs, for the average person is only familiar with the work of the API. If you do interface development, then you need to learn SWING/AWT/SWT and other APIs, if you do online game development, you need to understand the network api/multimedia api/2d3d and so on, if you do Web development, you need to familiarize yourself with the servlet and other APIs. In short, you need to choose to learn specific APIs based on the needs of your job or the direction you are interested in developing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.