If you look in the directory where your JDK is installed, there is a file called src.zip that has the source files of all of the classes (some methods are marked native so you won't find their source code) in the API.
Other IDEs, like Eclipse, can also automatically show you the source code of the JDK classes. In Eclipse you need to attach the source to the JRE by doing this:
- Go to Window / Preferences... / Java / Installed JREs - Click on the JRE you want to attach the source to - Click the Edit... button - From the list of JARs, select rt.jar - Click on the button Source Attachment... - Enter the location of src.zip in the JDK directory - Click OK a few times to close the windows
Now Eclipse will show you the source for the JDK classes if you put the caret on a JDK class and press F3. Likewise you can attach the Javadoc API documentation to a JRE.