• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java is zero indexed  RSS feed

 
Saibabaa Pragada
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I want to know the reason why Java arrays/Collections framework classes are zero-indexed. Please let me know.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the JLS says so.
http://java.sun.com/docs/books/jls/third_edition/html/arrays.html
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66259
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most languages are.
 
Trivikram Kamat
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a mathematical reason behind it also:
Why the Array Index should start from 0
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!