Learn Java from the Source

I’m continually suprised by the number of veteran Java programmers(those with more than six months’ experience) I encounter who aren’taware that the full source code for the standard Java libraries isincluded with most Java development distributions. In a typicalWindows installation of Sun’s Java Development Kit, the source code ispackaged in a JAR file called “src.jar,” which is usually in thetop-level directory where the JDK is installed (for example,C:jdk1.3src.jar). The source tree can be extracted with the jarutility command:

     jar xvf src.jar

It can be quite informative to browse through this source code and seehow the “magic” behavior of many of the common Java classes isimplemented. Those familiar with the concept of object-oriented designpatterns will see many excellent examples of applied patterns,particularly in the design of the Swing library and the Java 2Collections framework.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: