n Java. Instead of drawing the objects, please print the output of the objects. Bus airport = new Bus(); Bus school = new Bus(); Bus downtown; airport.passengers = 25; school.passengers = 30; airport = school; // change the reference airport, not what it is referencing downtown = school; school.passengers = airport.passengers + 2; Print airport.passengers; Print school.passengers; Print downtown.passengers; airport.passengers = 55; airport.passengers++; Print airport.passengers; Print school.passengers; Print downtown.passengers; 2) Bus airport = new Bus(); Bus school = new Bus(); Bus downtown = new Bus(); airport.passengers = 5; school.passengers = 11; school.passengers++; downtown.passengers = airport.passengers + 2; airport.passengers -= 1;
In Java.
Instead of drawing the objects, please print the output of the objects.
Bus airport = new Bus();
Bus school = new Bus();
Bus downtown;
airport.passengers = 25;
school.passengers = 30;
airport = school; // change the reference airport, not what it is referencing
downtown = school;
school.passengers = airport.passengers + 2;
Print airport.passengers;
Print school.passengers;
Print downtown.passengers;
airport.passengers = 55;
airport.passengers++;
Print airport.passengers;
Print school.passengers;
Print downtown.passengers;
2) Bus airport = new Bus();
Bus school = new Bus();
Bus downtown = new Bus();
airport.passengers = 5;
school.passengers = 11;
school.passengers++;
downtown.passengers = airport.passengers + 2;
airport.passengers -= 1;
Trending now
This is a popular solution!
Step by step
Solved in 2 steps