Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why an array start from index 0 in java but in some programming languages it starts from 1?

user-image
Question added by Afzali Jan Afridi , Android Application Dveloper , Tarmyz IT Solution pvt. (Munawla.com).
Date Posted: 2015/04/28

 Def:- Array is ahomogenios collection values

Array always Starts form0 to N numbers 

If you take in any prgraming Langauge Likes of C,C++,Java Array will Start from0 onward 

-----------------------------------------------------------------------------

Muhammad Iqbal
by Muhammad Iqbal , Java Engineer , Celerant Technology

because the creators of the language decided it that way, supposedly to make the transition easier for C developers, but, the complete correct answer is: because it was designed that way.

سعد رضا ٰ
by سعد رضا ٰ , Software Engnieering , None

:look here to a strong  argument than Edsger W. Dijkstra's article

"Why numbering should start at zero"

and this answer 

http://stackoverflow.com/a/3484890

Mohamed Alesh
by Mohamed Alesh , Independent Contractor / Consultant , Upwork (Engineering Team - APIs)

This is probably a design decision, and since java syntax belongs to C and C++ family I think it makes sense to have indexes start with0. During my experience and if I remember correctly, the only thing that I have seen uses1 was the XSLT, there are others sure but that was the one I experienced in my jobs. I hope this answers your question.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.