Jump to content

implementation of ready classes

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
7 replies to this topic

#1
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
hi all
I want to know how can I find the implementation of some classes in java
ex. I want to know the implementation of method charAt in class string

#2
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
Download java source code: http://www.java.net/...30_aug_2010.jar
it's all there.

    public char charAt(int index) {
        if ((index < 0) || (index >= count)) {
            throw new StringIndexOutOfBoundsException(index);
        }
        return value[index + offset];
    }

as you might have guessed. String is actually array of chars, and charAt returns a certain character from the array.

#3
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
I downloaded JDK, but I'mnot found what I search

#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
If you're using eclipse i believe it's ctrl+shift+T or so, it's called "open type" and if you type "String" there, or any other class it will open it. Other IDEs most likely also have such a feature.

#5
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
Oxano, i don't think Eclipse comes with the source. I believe it only contains the compiled bytecode by default. It's "control" key, that takes user to the requested source, but it just says "source not found".

eman ahmed, look at there: \j2se\src\share\classes\java\

#6
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
never mind :-P

#7
eman ahmed

eman ahmed

    Learning Programmer

  • Members
  • PipPipPip
  • 79 posts
thanks to all , but I'm still have the same problem

#8
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
In 'C:\Program Files\Java\jdk1.6.0_21' (jdk version may vary) I got this file 'src.zip' which contains all the .java files of all the classes.