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
Chat with our AI personalities
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.
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.
You don't specify "these methods", but chances are what you're looking for is the charAt method
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.
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.