• Post Reply Bookmark Topic Watch Topic
  • New Topic

need method of returning index value of array  RSS feed

 
battousai liang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm very new to Java, i am stuck trying to find a way of writing a method that can use a single argument which is an index of a group in an array, i need it to return
as int value of the index given by the argument.

So for example if a user types in findBox(3); it will return the value of what the int value is of Box3 in the array

i have scrapped the code that i wrote, so it would be nice to see some examples of how it works.

thanks
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Was that what you had in mind? Or was it something not quite like that?

And by the way, welcome to the Ranch!
 
battousai liang
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's exactly it!!

thank you!
 
Rafael Prado Oliveira
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:

Was that what you had in mind? Or was it something not quite like that?

And by the way, welcome to the Ranch!


Make sure to avoid a nullpointer, or if the index is out of the range
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!