I have this class its basically a university system on which a student can post different kind of posts and people can reply to there posts.
Event is a kind of post
public class Event extends Post {
private String Venue;
private String Date;
private int Capacity;
private int AttendeeCount;
String[] Attendee_list=new String[getCapacity()]
public Event(String Id,String Title,String desc,String CreatorID,String Venue, String Date, int Capacity)
{
//ID i.e eventID and CreatorID are auto created
super(Id,Title,desc,CreatorID);
this.Venue=Venue;
this.Date=Date;
this.Capacity=Capacity;
AttendeeCount=0;
}
i am trying to implement this method.
where reply.getResponderID() basically gets responder id of reply on post.
when i am trying to add the responder it to the attendee list of the event after it passes the if() condition it is throwing an arrayindexoutofbound exception.
@Override
public boolean handleReply(Reply reply)
{
if (AttendeeCount < Capacity & !(Arrays.asList(Attendee_list).contains(reply.getResponderID())))
{
Attendee_list[AttendeeCount]=reply.getResponderID();
getReplyCollection().add(reply);
AttendeeCount++;
return true;
}
return false;
}
I can't figure out why???