If you try to see the code for JDK classes you might get this error:
Source not found. The JAR file …\rt.jar has no source attachment.
To fix this you need to attach the JDK to your IDE.
In Eclipse, select Windows -> Preferences -> Java -> Installed JREs , select the installed JDK, expands
rt.jar, select “Source attachment” and find the
src.zip from your disk drive, which is under the folder your JDK is installed.