API Docs


In this section you'll learn your way around the Java API documentation.


First, you'll need to open up a copy of the API documentation in a new browser window. You can either open the copy at the Java website, or open the file jdk/docs/api/index.html on your machine, if you can find the JDK directories and they have the docs installed (unlikely).

The first thing you'll notice when you open the documentation, is that it's divided into three frames, each containing different levels of information.

Screenshot of the opening webpage for the API docs

When you first open the API docs, the page contains information on all the packages and classes in the API.

Scroll down in the frame in the top left hand corner until you find the package 'java.lang'. Click on it.

You'll see that the frame below, that started off containing all the classes, switches so that it now just contains the classes and interfaces in java.lang. If you scroll down in this frame, you'll see it also lists the Exception and Error classes associated with the package.

Scroll back up to the top of this frame, and click where it says 'java.lang' immediately above the word 'Interfaces' (it looks like a section title, but is also a link).

The big window on the right hand side of the screen will now be displaying more detailed information on all the interfaces, classes and exceptions in the package. If you scroll down passed these, you'll also find a description of the package and when/how you might use its different classes.

It is vital that you become familiar with how to use the documentation to find stuff out, especially when and how you use classes.

In many ways, this is the most important thing you'll need to learn on this course. No course could possibly teach you all of Java, or even a thorough introduction - indeed, no one in their right minds would try to learn everything there is about Java anyway. What you need to learn is where to find information in the documentation, and what to do with it. Over the rest of the course, we'll increasingly say "if you need this information, check the docs". Many of the docs contain more than just the basics of the classes - many have mini tutorials and links to websites with examples and 'how to's.

In the next section we'll look at the docs for a single class. When you think you understand what the docs are showing for java.lang, go on to part two.