How can I call call the retriveRoom method and return the rooms[connectedRoom] object, and use the objects properties inside of the method in the ROOMS CLASS? Any help is greatly appreciated. It is saying it cannot find the room.numLights in the system.out.println???
//MASTERCONTROLPANEL CLASS
public static Object retrieveRoom(int connectedRoom){
connectedRoom -= 1;
return rooms[connectedRoom];
}
//ROOMS CLASS
public void roomHeatLoss(){
//I am having problems with the line below//
***Object room***= MasterControlPanel.retrieveRoom(1);
System.out.println("" + room.numLights);
}
Try changing the method to return a Room or casting the Object prior to invoking the method.
Either this:
or this:
You don’t say what your problem is. That would help us to figure out what to suggest.