The following hierarchy of inheritance is given: class Building { int roomNo; int bathNo; public Building() { roomNo = e; bathNo = e; public Building(int room, int bath) { roomNo = room; bathNo -...


JAVA language..


The following hierarchy of inheritance is given:<br>class Building {<br>int roomNo;<br>int bathNo;<br>public Building() {<br>roomNo = e;<br>bathNo = e;<br>public Building(int room, int bath) {<br>roomNo = room;<br>bathNo - bath;<br>eOverride<br>public String toString() {<br>return roomNo +

Extracted text: The following hierarchy of inheritance is given: class Building { int roomNo; int bathNo; public Building() { roomNo = e; bathNo = e; public Building(int room, int bath) { roomNo = room; bathNo - bath; eOverride public String toString() { return roomNo + "\t" + bathNo; class Residential extends Building{ } class Commercial extends Building{ double commonSpaceArea; public Commercial(int room, int bath, double area) { super(room, bath); commonSpaceArea = area; public String toString() { return roomNo + "\t" + bathNo + "\t"+ commonSpaceArea; class Townhouse extends Residential { int houseInRow; public Townhouse(int room, int bath, int houseNo) { roomNo - room; bathNo = bath; houseInRow - houselo; public String toString() { return roomNo + "\t" + bathNo + "\t"+ houseInRow; } class Detached extends Residential {
what will be the output of the following code?<br>Object obji = new Building(2, 2);<br>Building obj2 = new Building(4, 3);<br>Building obj3 = new Residential();<br>Building obj4 = new Commercial(10, 2, 80.e);<br>Building objs = new Townhouse(5, 1, 6);<br>Building obj6 = new Detached();<br>Residential obj7 = new Residential();<br>Residential obj8 - new Townhouse(5, 1, 6);<br>Residential obj9 - new Detached();<br>Object obj1e = new Townhouse (3, 2, 5);<br>System.out. println(obji1);<br>System.out.println(obj2);<br>System.out.println(obj3);<br>System.out.println(obj4);<br>System.out.println(obj5);<br>System.out. println(obj6);<br>System.out.println(obj7);<br>System.out.println(obj8);<br>System.out.println(obj9);<br>System.out.println(obj1@);<br>A-<br>В<br>I<br>X2<br>x2<br>

Extracted text: what will be the output of the following code? Object obji = new Building(2, 2); Building obj2 = new Building(4, 3); Building obj3 = new Residential(); Building obj4 = new Commercial(10, 2, 80.e); Building objs = new Townhouse(5, 1, 6); Building obj6 = new Detached(); Residential obj7 = new Residential(); Residential obj8 - new Townhouse(5, 1, 6); Residential obj9 - new Detached(); Object obj1e = new Townhouse (3, 2, 5); System.out. println(obji1); System.out.println(obj2); System.out.println(obj3); System.out.println(obj4); System.out.println(obj5); System.out. println(obj6); System.out.println(obj7); System.out.println(obj8); System.out.println(obj9); System.out.println(obj1@); A- В I X2 x2
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here