Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

index out of bounds error

807598Dec 14 2005 — edited Dec 14 2005
Hi,

I have a problem with the index out of bounds error for a vector.
I have initialised a vector that is same size as a previous vector declared in my program and inserted a float object in all the positions.
The code below is a for loop to do just this where count is the size of the previous vector.

for(int i=0;i<count; i++)
{
vLargest.setElementAt(zero,i);
}
the float object is declared as
Float zero = new Float(0.0)

The error that i'm getting is

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.setElementAt(Vector.java:492)
at ReadFile.makeData(ReadFile.java:62)
at ReadFileTest.main(ReadFileTest.java:10)

Can anybody tell me what this means?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2006
Added on Dec 14 2005
6 comments
3,260 views