I am quite confused on how my array is formed. This is what is written to make the array.
public class TestProgram {
public static final Room[] rooms = new Room[]
{
new Room ("GARDEN0001", "NorthWest Garden View", 45.00),
new Room ("GARDEN0002", "SouthEast Garden View", 65.0),
new Room ("GARDEN0003", "North Garden View", 35),
new Room ("GARDEN0004", "South Garden View", 52),
new Room ("GARDEN0005", "West Garden View", 35),
new Room ("GARDEN0006", "East Garden View", 35)
};
and I think the data comes from this class:
public class Room {
public Room(String roomId, String description, double dailyRate){
this.roomId = roomId;
this.description = description;
this.dailyRate = dailyRate;
this.status = 'A';
}
Us this a way of declaring an array from a constructor from another class or something? I am pretty confused but it works.
Can someone explain to me why is it written as Room[] rooms = new Room[]
?