Activity 5.1 - Exploring the API documentation

Topic

This activity explores the API documentation.

Materials

We will use the Java 2 Standard Edition 6.0 API Specification, which is accessible from NetBeans by selecting Help|Javadoc references|Java Platform SE 6.

You can also find the documentation online, for example at http://download-llnw.oracle.com/javase/6/docs/

There is a discussion of this activity in the Solution document in this project.

Instructions

  1. Using the online source, when the browser opens you will see a schematic of the Java SE Platform with a navigation bar (a row of links) near the top of the page.

    screen grab of JDK documentation

    Click on the link Java SE 6 API Documentation. You will be presented with a list of the Java 2 Platform Packages.


    frames view of Java SE documentation

    Scroll down to java.lang. Read the summary in the right-hand column then follow the link for java.lang.

  2. Now follow the Description link from java.lang to see a complete description of this package. The Description link takes you towards the bottom of the page.

  3. Scroll back towards the top of the page and go to the second section, which is the Class Summary. Go down the classes until you come to String and read the summary of what this class does.

  4. Now follow the link for String. This will take you to a comprehensive description, containing all the information a programmer needs to make use of this class, presented in a standard format. The API documentation provides a similar description of every class in every package of the API.

    Answer the following questions about the class String:

    (a) What is its immediate superclass?

    (b) How many constructors does it have?

    (c) Look at the method summary. What does the method compareTo(String anotherString) do and what is its return type?

    (d) Follow the link from the name of the method, compareTo(String anotherString) to find the more detailed specification of this method.

    (e) Return to the method summary. How many deprecated methods are there?

    (f) From the method summary, how many groups of overloaded methods are there?

  5. Scroll to the top of the API page, where there is a navigation bar, like this:

    Overview Package Class Use Tree Deprecated Index Help

    This bar is standard on all pages of the API. Follow the link to Index. This will take you to a list of all the classes, constructors, methods and variables in the entire API, organised alphabetically.

    Use this index to locate the method get(int) in class java.util.LinkedList (there are a number of get(int) methods but we are interested in this specific one). Follow the link to the method and look up what exception it may throw.

  6. Return to the navigation bar and select Help.

    Have a quick look at this explanation of how the API documentation is organised. Don't worry about any terms you don't recognise. They will all become clear by the end of the course.