Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I do not understand what "get(0);" means.  RSS feed

 
derek smythe
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am having problems understanding the following code any help greatly appreciated as I could not find the answer anywhere. Here is the code




I do not understand the "get(0);" please if anyone can explain that please Thank you. Derek
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you look up the javadoc for the get() method? What aspect is confusing to you?
 
derek smythe
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no I didn't look it up, I was wondering where I can find the javadoc, is there a link to the page please? That would be great. As I can write down the link in the back of my Head First Java book to help me along. I understand it now, get(0) returns the object at element 0 i think, or index 0. I think. But a link to the javadoc would be great as I didn't find anything for google search under java documentation. There is another question I have but it is so complicated that I am not even sure how to phrase the question yet. LOL. thank you. Derek
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a tip: just write the full classpath of a class into a reply, such as

java.util.ArrayList

and voila, it's a link to the javadoc! Cool, no?
 
derek smythe
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome thanks Bear! that is cool. Do you mean that I have to post a reply with the java.util.ArrayList in it to see the link? Also, I was wondering, how do I know what package a certain class native to the java language is in. Once I know how to find the java classes definitions in the documentation, I will be INVINCIBLE. muwahahah. ok any more help greatly appreciated. thank you. Derek

EDIT: Nevermind. I found the link from the one you gave me. This is the main page that will let me help myself hopefully.

java docs
 
Paul Clapham
Sheriff
Posts: 22502
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
derek smythe wrote:I found the link from the one you gave me. This is the main page that will let me help myself hopefully.

java docs


Yup. Make sure you bookmark it. A lot of programmers just leave it permanently open in a browser tab while they are working.

(You asked how to find what package a particular class is in? There's an "Index" link at the top of every single page in the docs.)
 
Campbell Ritchie
Marshal
Posts: 55717
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the API documentaton, the fully-qualified name of the class appears at the top left, like this java.laString. The smaller writing is the class name. If you hover the mouse over the name of the class in the lower left pane, a tool tip appears saying "class in java.lang" or similar.
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best way to find the documentation of any java class is to type: java <name of class> into the google search engine, it will usually pop up at or near the top
 
Campbell Ritchie
Marshal
Posts: 55717
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I earlier wrote: . . . java.laString. The smaller writing is the class name. . ..
Oops! The larger writing is the class name and the smaller writing is the package name. Sorry for that mistake, which you have doubtless already noticed.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unnar Björnsson wrote:The best way to find the documentation of any java class is to type: java <name of class> into the google search engine, it will usually pop up at or near the top

Yeah but it's not always the latest version. It'd be best to bookmark the javadoc.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!