Skip to Main Content

Java Programming

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 exception error

807605Sep 16 2007 — edited Sep 17 2007
hey guys

The system im making is a video store
right now im trying to return a video that has already been rented by a customer

the method i have is

Class Customer

public void retearn(Video video)
{ this.video = video;
videos.get(id); }

where videos.get(id) is highlighted

all methods related to this problem are as follows

Class Videos

public void retearn()
{ System.out.println("\tEnter video ids, 0 to exit");
int id = readId();
while (id != 0)
{ Video video = find(id);

if (video != null)
{ System.out.println("\t\t\t" + video.name());
rental.remove(video);
rental.removeFromCustomer(video);
id = readId(); }

else
System.out.println("\t\t\tCustomer does not have this video");
id = readId();
}
}

Class Rental

public void remove(Video video)
{ this.video = video; }


public void removeFromCustomer(Video video)
{ this.video = video;
customer.retearn(video); }




i get this error
IndexOutOfException:
Index: 1, Size: 1(in java.util.LinkedList)

im unsure of why im getting this error, but the purpose of this method is to return a video that has been burrowed by a customer.

any suggestions would be greatly appreciated
Thank you very much in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 15 2007
Added on Sep 16 2007
4 comments
1,948 views