Forums Register Login

Source code for library classes/methods?

+Pie Number of slices to send: Send
Hey guys

Im a beginner doing some random programs here and there and finding the java libary very usefull. There is one thing though, where can I find the source code for the methods I use. Like for example im trying to find how the String Class Replace method was done, but I cant find this anywhere. Doing a search only takes you to example that used it

Thanks
+Pie Number of slices to send: Send
Did you try searching for "java source code"?
+Pie Number of slices to send: Send
 

Christiaan Thamm wrote:where can I find the source code for the methods I use. Like for example im trying to find how the String Class Replace method was done...


There's nothing particularly wrong with looking at source code to "find out how the experts do it", but do be very careful that you don't fall into the trap of writing programs that rely on (or assume) a particular implementation.

There's a reason the designer hid the source from you: they might want to change it later.

Also: while you can get source for most of the Java foundation classes, you may not be able to get it for 3rd party libraries or jars.

Winston
+Pie Number of slices to send: Send
One thing I have found useful with Maven is that it makes it easy to download the source from 3rd party open source libraries for you. Also, if you use m2eclipse to open maven projects from Eclipse, Eclipse automatically downloads the source of a class when you open a class. It makes solving problems a breeze. Most of the problems with 3rd party libraries is either that the programmer didn't understand the API, or the API wasn't documented well. Being able to debug through 3rd party libraries seamlessly through the IDE makes solving problems so much easier.
I found some pretty shells, some sea glass and this lovely tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 497 times.
Similar Threads
MSN through j2me
Cant think of a suitable title
using classes in jsp (not servlets )
Simple examples
display.setCurrent() --- switchDisplayable() Difference???
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:43:18.