next up previous
Next: java.util.Random Up: The Frightened Freshers Guide Previous: Multidimensional Arrays

The Java API

Perhaps the most important thing is the Java API. You may not know it but a lot of the things featured in this document come from the java API and I have not shown you how to import packages so if you just typed them out then they would not work.

The java API can be found at the Sun site, http://java.sun.com/j2se/1.4.2/docs/api/. There is a local copy of the Java API here too http://www.cs.kent.ac.uk/java/api/, although be warned that the local copy is Java 5 and not Java 1.4, which is what we are taught. Either way, looking at the Java API page you can see that it is split into three frames. Top left is the list of packages and clicking on one will cause the second frame to change to just the Classes in that package. Go ahead and click on java. Click on the java.util link, and all the Classes from java.util will be displayed.

Importing a package for use in a program is easy!
\begin{lstlisting}
import java.packagename.subpackagename;
\end{lstlisting}

An example of this is importing the ArrayList Class
\begin{lstlisting}
import java.util.ArrayList;
\end{lstlisting}

If you click on one of the Classes from the package in the second frame then a larger view will open up in the main frame telling you lots of important information about this Class. This is called the Interface to the Class. Click on the Random link, and guess what. New topic.


next up previous
Next: java.util.Random Up: The Frightened Freshers Guide Previous: Multidimensional Arrays
Tom Carlson 2006-01-10