Results 21 to 23 of 23
- 12-16-2011, 04:23 PM #21
Re: Make the sum of all elements of only one dimension of an array
One of the indexes you are using is past the end of the array. If you don't know which one, print out all their values so you can see which one it is.java.lang.ArrayIndexOutOfBoundsException: 4
Remember that array indexes start at 0 and go to the array length -1.
- 12-16-2011, 05:17 PM #22
Member
- Join Date
- Dec 2011
- Posts
- 11
- Rep Power
- 0
Re: Make the sum of all elements of only one dimension of an array
I don't understand.
- 12-16-2011, 05:26 PM #23
Re: Make the sum of all elements of only one dimension of an array
Please explain what part of what I said you do not understand.I don't understand.
Here is a sample of how to get this error: ArrayIndexOutOfBoundsException: 4
int[] anArray = new int[4];
System.out.println(anArray[4]);
Add a println in the sum method that prints out the values of all the variables passed to the method.
Similar Threads
-
Single to multi-dimension array
By Migy in forum New To JavaReplies: 2Last Post: 04-05-2011, 06:12 PM -
Taking out elements from a matrix thus reducing its dimension
By theodorekon in forum New To JavaReplies: 5Last Post: 04-15-2010, 05:55 PM -
[SOLVED] how to align JTextFiels[dimension] and JComboBox[dimension]
By Wolverine in forum AWT / SwingReplies: 5Last Post: 05-18-2009, 12:42 PM -
noob: two-dimension array
By bobmasta5 in forum New To JavaReplies: 5Last Post: 03-15-2009, 11:42 PM -
Arraylist to a 2- dimension array conversion
By mars123 in forum New To JavaReplies: 1Last Post: 12-06-2007, 11:24 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks