Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
As you've seen so far in this course, when you work in Java you are highly dependent on the classes that are a part of the Java Class Library. You can find documentation about these classes in the API documentation that's hosted on the Oracle website. One way to get to that documentation is simply through a browser. You can download the documentation locally, but by using the version that's on the Oracle website, you'll be sure you are looking at the most recent version. I am going to go to Google and search for Java 6 API docs.
You can also look for Version 7 if that's the version of Java you want to use. This link takes you to the documentation. You'll see that there are literally thousands of classes to choose from, shown in this list in the lower left hand corner. You can filter the list if you know the package or group that a class is a member of. For example, one of the most commonly used packages in Java is called java.lang. A package is a group of classes that have common characteristics or work together in some way.
I'll click on java.lang and I'll see a list of all sorts of classes that you'll use frequently in your Java programming. So for example, here is the String class. If I click on the link, it shows me all the documentation about the String class, the class that represents a string value. I've also used the System class so far, and that's also in java.lang. Now, you can also get to this documentation easily through Eclipse. You'll still need to be connected to the Internet, because you'll be referring to the same files up on the Oracle website, but you'll be able to get to what you want much more quickly if you know a couple of little tricks.
So I am going to return to Eclipse, and let's say, for example, that I want to learn about the String class. I am going to move the cursor over the word String and after a moment Eclipse pops up a little bit of documentation. Notice in the lower right hand corner of the pop-up window it says press F2 for focus. So I'll press F2 and now I can expand and scroll through this set of documentation. And not all of the documentation that shows up in this window will contain links to get to the full docs for a particular class.
So here is another way to do it. I am going to double click the word String to select it. Then I'll go to the Menu and choose Help>Dynamic Help. I see a new view appear on the right, the Help View. And I see a link, javadoc for 'java.lang.String'. When I click the link, that takes me to the full documentation for that particular class. I'll double click the Tab of the Help View and now I can scroll through and read everything about the String class; all of the different methods, properties, constructive methods, and everything else about it.
I'll close the Help View and return to the main Perspective. Finally, I'll also show you that when you are working with a property of a class, and that property is an instance of a particular Java class, you can frequently get to the Javadocs for that class very simply. Just move the cursor over the property name and wait for a moment until the pop-up window appears. Then press F2 to give it focus. You can once again expand and scroll through the contents, and you'll see that the out property of System is an instance of a class called java.io.PrintStream.
When you click the link, that takes you directly to the documentation for that class. And you can once again expand to Full Screen and read everything you want about the class and how to use it. So that's a look at how to get to the Java API documentation. Again, you can get to the complete documentation set through the browser; you'll be looking at documentation from the Oracle website. Or you can look at the documentation directly from within Eclipse, by using the dynamic Help feature or by using the F2 pop-up window that gives you direct access to the documentation for the classes that you are working with.
Get unlimited access to all courses for just $25/month.Become a member