2

Not sure if this has been asked before, did some digging. I'm trying to prepare for a few interviews, and I was just curious to see if how Java implements its data structures (arraylist, map), etc is public.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Dirk
  • 6,774
  • 14
  • 51
  • 73

4 Answers4

10

src.zip inside the JDK.

Tom Hawtin - tackline
  • 145,806
  • 30
  • 211
  • 305
  • Finding the 'src.jar' file on Mac OS X can be tricky in recent years (2010-2011). See these two related questions for answers: [this one](http://stackoverflow.com/questions/4120107/source-code-for-mac-os-x-java-version-1-6-0-22), and [that one](http://stackoverflow.com/questions/4011002/java-eclipse-on-macosx-where-is-the-src-zip). – Basil Bourque Aug 01 '11 at 08:23
4

You can get latest source code from the JDK7 repository. (JDK 6 is here.)

Thomas Jung
  • 32,428
  • 9
  • 84
  • 114
3

Use a modern IDE (like eclipse), link the locally installed Java SDK to a Java Project and you can view the source code of (most) classes from the SUN Java development kit.

Extracting src.zip is an alternative but it .. say .. doesn't support code browsing ;)

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
1

Either src.zip, as suggested, or you can open them in your IDE (Eclipse for example), if you have set it up to use JDK.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140