answersLogoWhite

0

An index is basically a numeric association to an element in a collection of data.

When you talk about an index in Java, you will most often be talking about the position of an object in an array.

int[] numbers = new int[] {10, 20, 30, 40};

Given the array declared above:

numbers[0] = 10 <- Element at index 0 is 10
numbers[1] = 20 <- Element at index 1 is 20
numbers[2] = 30 <- Element at index 2 is 30
numbers[3] = 40 <- Element at index 3 is 40

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine

Add your answer:

Earn +20 pts
Q: What is an index in Java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the most common computer programming language?

You may want to take a look at the Tiobe index, which tries to track the tendencies in the use of different programming language. The top languages - according to this index - are currently (as of December 2013) C, Java, Objective-C, C++, C#, PHP, (Visual) Basic, Python, Transact-SQL, JavaScript. And lots of others; take a look at the Index for more information.


What happens if an array overrun occurs in java?

If you mean that you try to access an index outside of the bounds of the array, then it will result in an IndexOutOfBoundsException being thrown.


Which of these methods of string class is used to obtain character at specified index?

You don't specify "these methods", but chances are what you're looking for is the charAt method


What percent of programmers use Java?

Hi there, according to Tiobie index Java is the number 1 language being used today with 17.110% share. Followed by C with 17.087% share. The Tiobie index data is sourced from the number of world-wide professionals, courses available and thirds party vendors. Plus search engine results. I recon it is a good indicator for programming language popularity.


Create an array of 10 elements in java?

to create a new Java array use typeName[] arrayName = new typeName[10]; This gives an array with 10 elements. To set the elements you can use arrayName[index] = value; Remember that the index number starts at 0, so the array will only go to index 9. You can also declare the contents when the array is created typeName[] arrayName = {value1, vaue2, ...} The values used in the array must be objects. In java 5+ you can use primitive types with no concern due to auto-boxing.