my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Java is zero indexed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Java is zero indexed" Watch "Java is zero indexed" New topic

Java is zero indexed

Saibabaa Pragada
Ranch Hand

Joined: Oct 24, 2010
Posts: 162
Hi, I want to know the reason why Java arrays/Collections framework classes are zero-indexed. Please let me know.
Darryl Burke

Joined: May 03, 2008
Posts: 5093

Because the JLS says so.

luck, db
There are no new questions, but there may be new answers.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Most languages are.

[Asking smart questions] [About Bear] [Books by Bear]
Trivikram Kamat
Ranch Hand

Joined: Sep 26, 2010
Posts: 155
There is a mathematical reason behind it also:
Why the Array Index should start from 0

I agree. Here's the link:
subject: Java is zero indexed
jQuery in Action, 3rd edition