+91-85006-22255
Define the Room and Fan classes such that the following program compiles and runs without errors.
Room
Fan
class RoomAndFan { public static void main(String s[]) { Room hall = new Room(); hall.width = 14; hall.length = 20; hall.name = "First Hall"; hall.fan = new Fan(); hall.fan.color = "Brown"; hall.fan.speed = 1200.0; hall.fan.numberOfWings = 3; System.out.println(hall.name + " has a fan with " + hall.fan.numberOfWings + " wings and its speed is " + hall.fan.speed + " rpm. Its color is " + hall.fan.color +"."); } } class Room {
} class Fan {
}
Topic: Calling A Class From Another Class In Java
Read this topic Take test on this topic
Open In App