JAVA CLASSESS Write the output of the following statement : class Rectangle{ int length,width,length1; void insert(int l,int w){ length=1; width=w; } void insert(int 1){ length1=1; } void display1() {...



JAVA CLASSESS



Write the output of the following statement :


class Rectangle{


int length,width,length1;


void insert(int l,int w){


length=1;


width=w;


}


void insert(int 1){


length1=1;


}


void display1()
{
System.out.println(width);


}


void display2()
{
System.out.println(length);
}
void calculateArea()
{
System.out.println(length*width);


} void calculateArea3()


{


System.out.println(length1);


}


void calculateArea2()
{
System.out.println(length width 2);


}


}
class Test Rectangle2{ public static void main(String args[]){


Rectangle r1-new Rectangle();


Rectangle r2-new Rectangle(); Rectangle r3-new Rectangle();


r1.insert(10,5); r2.insert(3,5);


r3.insert(2);


r1.display1();


r1.display2();


r1.calculateArea();


r2.calculateArea2();


r2.display1();


r2.display2();


r2.calculateArea();


r2.calculateArea2();


r3.calculateArea3();


r3.display1();


}


}




31-34 Answer the ff.


 a.) 5         b.) 10      c.) 30     d.) 50


31. What is the output of line 40?


32. What is the output of line 41?


33. What is the output of line 42?


34. What is the output of line 43?



35-38 Answer the ff.


a.) 3         b.) 5      c.)15     d.) 30


35. What is the output of line 44?


36. What is the output of line 45?


37. What is the output of line 46?


38. What is the output of line 47?



39-40 Answer the ff.


a.) 0        b.) 2      c.)3      d.) 5


39. What is the output of line 48?


40. What is the output of line 49?


Line,<br>32 class Test Rectangle2{<br>public static void main (String args[]){<br>Rectangle r1=new Rectangle();<br>Rectangle r2=new Rectangle();<br>Rectangle r3-new Rectangle();<br>r1.insert(10,5);<br>r2.insert(3,5);<br>r3.insert(2);<br>r1.display1();<br>r1.display2(%3;<br>r1.calculateArea();<br>r2.calculateArea2()3;<br>33<br>34<br>35<br>36<br>37<br>38<br>39<br>40<br>41<br>42<br>43<br>44<br>r2.display1();<br>r2.display2();<br>r2.calculateArea();<br>r2.calculateArea2();<br>r3.calculateArea3();<br>45<br>46<br>47<br>48<br>r3.display1()3;<br>50 }<br>51 }<br>49<br>31. What is the output of line 40? a) 5 b) 10 c) 30 d) 50<br>32. What is the output of line 41? a) 5 b) 10 c) 30 d) 50<br>33. What is the output of line 42? a) 5<br>34. What is the output of line 43? a) 5<br>35. What is the output of line 44? a) 3 b) 5 c) 15 d) 30<br>36. What is the output of line 45? a) 3 b) 5 c) 15 d) 30<br>37. What is the output of line 46? a) 3 b) 5 c) 15 d) 30<br>38. What is the output of line 47? a) 3 b) 5 c) 15 d) 30<br>39. What is the output of line 48? a) 0 b) 2 c) 3 d) 5<br>40. What is the output of line 49? a) 0 b) 2 c) 3 d) 5<br>b) 10 c) 30 d) 50<br>b) 10 c) 30 d) 50<br>

Extracted text: Line, 32 class Test Rectangle2{ public static void main (String args[]){ Rectangle r1=new Rectangle(); Rectangle r2=new Rectangle(); Rectangle r3-new Rectangle(); r1.insert(10,5); r2.insert(3,5); r3.insert(2); r1.display1(); r1.display2(%3; r1.calculateArea(); r2.calculateArea2()3; 33 34 35 36 37 38 39 40 41 42 43 44 r2.display1(); r2.display2(); r2.calculateArea(); r2.calculateArea2(); r3.calculateArea3(); 45 46 47 48 r3.display1()3; 50 } 51 } 49 31. What is the output of line 40? a) 5 b) 10 c) 30 d) 50 32. What is the output of line 41? a) 5 b) 10 c) 30 d) 50 33. What is the output of line 42? a) 5 34. What is the output of line 43? a) 5 35. What is the output of line 44? a) 3 b) 5 c) 15 d) 30 36. What is the output of line 45? a) 3 b) 5 c) 15 d) 30 37. What is the output of line 46? a) 3 b) 5 c) 15 d) 30 38. What is the output of line 47? a) 3 b) 5 c) 15 d) 30 39. What is the output of line 48? a) 0 b) 2 c) 3 d) 5 40. What is the output of line 49? a) 0 b) 2 c) 3 d) 5 b) 10 c) 30 d) 50 b) 10 c) 30 d) 50
TEST II. PROGRAM TRACING<br>Line<br>class Rectangle{<br>int length,width,length%3B<br>void insert(int I,int w){<br>length=l3B<br>width=Dw3;<br>}<br>void insert(int I){<br>length1=l;<br>}<br>void display1()<br>{<br>System.out.println(width)3;<br>2.<br>4<br>6.<br>9.<br>10<br>11<br>12<br>13<br>14<br>void display2()<br>15<br>{<br>System.out.printIn(length)3B<br>}<br>void calculateArea()<br>16<br>17<br>18<br>19<br>20<br>System.out.printIn(length*width)3B<br>21<br>22<br>23<br>void calculateArea3()<br>24<br>{<br>System.out.printIn(length1);<br>26<br>25<br>27<br>void calculateArea2()<br>28<br>{<br>29 System.out.println(length*width*2);<br>30<br>}<br>31<br>

Extracted text: TEST II. PROGRAM TRACING Line class Rectangle{ int length,width,length%3B void insert(int I,int w){ length=l3B width=Dw3; } void insert(int I){ length1=l; } void display1() { System.out.println(width)3; 2. 4 6. 9. 10 11 12 13 14 void display2() 15 { System.out.printIn(length)3B } void calculateArea() 16 17 18 19 20 System.out.printIn(length*width)3B 21 22 23 void calculateArea3() 24 { System.out.printIn(length1); 26 25 27 void calculateArea2() 28 { 29 System.out.println(length*width*2); 30 } 31
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here