-1

In java, is there any way to access the methods to classes that already you import? For example, is there a way to view the code for all the methods used for arrays? Such as the constructors, add(), remove(), size()? I have checked oracle, but there is no code, only method names and parameters. I understand how the methods work, but i'd like to see the actual code used.

Brent
  • 51
  • 2
  • 10
  • 1
    primitive arrays have no methods, are you talking about `List`s or other `Collection`s ? – Aaron Oct 05 '16 at 16:02
  • @Nikem: Likely not a duplicate considering that the user is talking about *primitive* arrays, which are sparsely documented to begin with. – Makoto Oct 05 '16 at 16:07
  • @Nikem: Also, since arrays are a dynamically generated object, it may be tough to find the information one wants inside of the source code anyway. – Makoto Oct 05 '16 at 16:09
  • In your IDE you can ctrl+click on any method to see it's implementation even in the JDK. – Peter Lawrey Oct 05 '16 at 16:12
  • @Makoto ArrayList has constructors, add(), remove() and size(). But it's not clear. The definition of how arrays work is in the JLS, there is no source for them. – Peter Lawrey Oct 05 '16 at 16:16
  • @PeterLawrey: That's what I'm getting at. The duplicate question isn't going to point them in the right direction here, since there's no source to be had. – Makoto Oct 05 '16 at 16:17
  • @Makoto unless it's ArrayList the OP is actually talking about given the method names. It's the only source code they will find. – Peter Lawrey Oct 05 '16 at 16:18
  • I just wanted to see the code for methods that are usually imported. I figured out that I was just looking for the Array class file. Sorry, I'm really new to this and could've asked the question better. – Brent Oct 05 '16 at 20:44

1 Answers1

-1

Search for the JDK source code, depending on the version you want.