Navigating the API
The packages that make up the core of the Java environment and the interfaces, classes, and exceptions they contain are fully documented in what is known as "The Java API"
If you have never programmed in an object-oriented language like Java, what you see in the API probably won't make a whole lot of sense just yet. That's ok -- it will later on. For now, just click on the link above and familiarize yourself with its layout.
As you will discover, the API is a big document. Most programmers don't have to deal with all it has to offer -- and there is no sense in trying to memorize its contents. However, to program in Java, you do need to know how to navigate through it. To test your ability to find what you are looking for in the API, try finding the answers to the following questions:
| Test Your API Navigation Skills...
- In the java.util.Scanner class, the three methods named "hasNext" return something of type boolean. The method named "nextLine" in the same class returns something of what type?
- Name eight of the methods of the java.util.Scanner class that begin with an "n" that are not inherited from the class java.lang.Object, and then name two that are.
- What method of the java.lang.Math class will return the value of its first argument raised to the power of its second argument?
- Name the three fields of the java.lang.System class.
- How many constructors does the java.io.FileInputStream class have?
- The class javax.swing.JButton is an immediate subclass of what other class? (Hint: All classes in java are subclasses of the class java.lang.Object, and java.awt.Component is an immediate subclass of java.lang.Object.)
- How many classes comprise the java.lang package?
- To what package does the Ellipse2D class belong?