I'm using BlueJ as an IDE and whenever I try to compile this Java code it gives me an error: incompatible types
highlighting the brackets of:
s.getCourtSportArrayList()
Why this is happening?
public void showCourtBookings()
{
for(Sport s : sportList)
{
for(Court c : s.getCourtSportArrayList() )
{
System.out.println("Court: " + c.getCourt);
int i;
i=1;
for(Booking b : c.getBookings())
{
System.out.println("Booking: " + i + "Start Time: " + b.getTimeStart() + "End Time :" + b.getEndTime());
i = i + 1;
}
}
}
}
This is a class Club
, it contains two ArrayLists;
private ArrayList<Member> MemberList;
private ArrayList<Sport> sportList;
The Sport
class has the following ArrayList:
private ArrayList<Court> CourtList = new ArrayList<Court>();
The Court
class has these ArrayLists:
private ArrayList<Booking> listBooking;
Hopefully you can point me in the right direction. Thanks!
Edit: this is the code,
public ArrayList getCourtSportArrayList()
{
return CourtList;
}