Couldn't find them with a search and I want to see how they are implemented
-
there is a thing called google since september 1997 – Alberto Miola Jun 29 '13 at 10:17
-
That was the first thing I tried – Anon855 Jun 29 '13 at 10:18
-
1Then why didn't you find [this](http://stackoverflow.com/a/261270/645270) or [this](http://stackoverflow.com/a/2407226/645270) or [this](http://stackoverflow.com/a/4635413/645270)? – keyser Jun 29 '13 at 10:19
4 Answers
Oracle's implementation is largely based on openjdk. You can browse and search the API and view the source code online at docjar.com for example. http://docjar.com/docs/api/

- 108,737
- 14
- 143
- 193
-
-
1If you use an IDE and have the source installed... Big fan of your blog by the way. – Joni Jun 29 '13 at 10:54
-
Cheers, I should have more time over the Summer to add to it. If you like my blog you might like the `Performance Java User's Group` https://plus.google.com/u/1/communities/107178245817384004088?cfem=1 – Peter Lawrey Jun 29 '13 at 10:58
Most of the APIs are in the JDK in a file called src.zip. If you use an IDE it will find this archive for you automatically and if you show you the source.
e.g. Say you have
String s = "Hello World";
String hi = s.substring(0, 5);
You want to see the code for substring
so you <ctrl>
+ <click>
of substring and it takes you to the code which might look like this.
public String substring(int beginIndex, int endIndex) {
if (beginIndex < 0) {
throw new StringIndexOutOfBoundsException(beginIndex);
}
if (endIndex > value.length) {
throw new StringIndexOutOfBoundsException(endIndex);
}
int subLen = endIndex - beginIndex;
if (subLen < 0) {
throw new StringIndexOutOfBoundsException(subLen);
}
return ((beginIndex == 0) && (endIndex == value.length)) ? this
: new String(value, beginIndex, subLen);
}
With Java, your life will be much easier if you learn to use your IDE.
There is some code which is not in the src.zip. This is very low level code and you should think carefully before going too low level into the JVM.

- 525,659
- 79
- 751
- 1,130
-
Excellent. I think the people who wanted me to search did not know that..... – Anon855 Jun 29 '13 at 10:48
-
@Anon855 Many simple questions have answers on the web, but some times there is a better way IMHO. – Peter Lawrey Jun 29 '13 at 10:56
You might want to see http://openjdk.java.net/. However, I am not 100% sure that it is what you are looking for.

- 16,192
- 2
- 35
- 57