I'm trying to get this method to create two instances of the class 'Sport'. The method is passing in a array which has the information about the class which is then sent to the constructor to be created.
However, I'm unsure how to refer to instance 1 or 2 given my code.
public static void seperateValues(String sportDetail) {
String[] sportDetails = sportDetail.split(",");
System.out.println("Adding new sport to the Sport collection");
System.out.println(sportDetail);
/*
for(int i=0; i<sportDetails.length; i++) //just used for testing whether it was splitting correctly {
System.out.println(sportDetails[i]);
}*/
//name,usagefee,insurance,affiliationfees, then court numbers
//Tennis,44,10,93,10,11,12,13,14,15,16
int vlength;
vlength = sportDetail.length();
new Sport(sportDetails); //this static methods loops twice, giving tennis and baseball
System.out.println(name); //this lists tennis and baseball respectively
}
//this static methods loops twice, giving tennis and baseball", do you mean theseperateValues()method gets called in a loop somewhere else?