• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

What does index mean in Java?

 
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm writing a program and I'm a little bit confuse on what index does in Java. Can someone please tell me what index is used for in Java?

Here my code if you need it.



Thanks In Advance
 
author & internet detective
Posts: 42160
937
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The index is the position in the array. So the first element is index 0. Which is "Tacos". The second element is index 1. Which is "Pizza". Etc
 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the reply and I enjoy reading your book OCA 8.
 
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The term "index" is not specific to Java. In programming languages, "index" usually refers to an ordinal number which is a number that defines a thing's position in a series of things. An array contains a series of same-typed elements, A String contains a series of characters, and a List contains a series of objects. You can use an index to reference any particular element, character, or object in these. In Java, index values are usually 0-based. That is, the first item in a series has an index of 0 and the last item has an index of (length - 1) where length is the total number of items in the series.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic