I have problem with my code here
Seller[] seller = new Seller[numberOfSellers]; // Declared global
// Some operations here
seller[i].setJoinDate(joinDate);
seller[i].setNumberOfPost(numberOfPost);
seller[i].setCustomerReview(customerReviewCount);
seller[i].setSafeTag(safeTag);
Then I have this Seller class with these methods
public void setJoinDate( String joinDate ) { this.joinDate = joinDate; }
public void setNumberOfPost( int numberOfPost ) { this.numberOfPost = numberOfPost; }
public void setCustomerReview( int customerReview ) { this.customerReview = customerReview; }
public void setSafeTag( String safeTag ) { this.safeTag = safeTag; }
Above is the shortened code of mine. If it is unclear please do point me where.
Basically I creating an array of instance. Then I will set the data.
Assuming the joinDate,numberOfPost,customerReviewCount,safeTag and lastly the numberOfSellers has no problem with is which it is.
The problem I had is at the setting of the data to the instance. Which is the setJoinDate,setNumberOfPost,setCustomerReview,setSafeTag. Anyone can help me detect my error here?
When I execute the program, it gives me this error
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at fyp.draft.pkg1.Design.actionPerformed(Design.java:247)
Design.java:247seller[i].setJoinDate(joinDate);locatedSeller[] seller = new Seller[numberOfSellers];numberOfSellers