For JDK6 you can download the source from java.net. For java.lang
the story begins at j2se/src/share/native/java/lang/
, and then search... JDK7 rearranges the directory structure a little.
Some methods, such as Object.hashCode
, may be implemented by hotspot instead or in addition to through JNI/Java.
JDK6 is freely licensed through the Java Research License (JRL) and Java Internal Use License (JIUL). JDK7 and OpenJDK6 is licensed under GPL 2 with CLASSPATH exception (roughly speaking you can link to it without catching the GNU virus). I am not a lawyer.
(BTW: The real lawyers would like to point out that I am still an employee of Sun Microsystems. Sun UK is no more. It is now Oracle.)
Update (Adding location for Thread.c):
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/Thread.c
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…