The Java Course provides a general introduction to programming in Java. It is based on A.B. Downey's book, How to Think Like a Computer Scientist. Click here for details.

Reading Documentation

If you go to the Java documentation site and search for charAt, you will get the following documentation (or something like it):

public char charAt(int index)

Returns the character at the specified index.
An index ranges from 0 to length() - 1.

Parameters: index - the index of the character.

Returns: the character at the specified index of this string.
         The first character is at index 0.

Throws: StringIndexOutOfBoundsException if the index is out of range.

The first line is the method's prototype (see Section 4.12), which indicates the name of the method, the type of the parameters, and the return type.

The next line describes what the method does. The next two lines explain the parameters and return values. In this case the explanations are a bit redundant, but the documentation is supposed to fit a standard format. The last line explains what exceptions, if any, can be caused by this method.

Last Update: 2011-01-24