File tree Expand file tree Collapse file tree 1 file changed +10
-22
lines changed
Expand file tree Collapse file tree 1 file changed +10
-22
lines changed Original file line number Diff line number Diff line change 1- //Need Practice the same thing again.
2- //Solve Again Revise This.
3-
41class RectangleSuper {
52 int length ;
63 int breadth ;
74
85 // Default constructor
9- RectangleSuper ()
10- {
6+ RectangleSuper () {
117 length =breadth =1 ;
128 }
139
1410 // Parameterized constructor
15- RectangleSuper (int l , int b )
16- {
11+ RectangleSuper (int l , int b ) {
1712 length =l ;
1813 breadth =b ;
1914 }
2015}
2116
22- class CuboidSuper extends RectangleSuper
23- {
17+ class CuboidSuper extends RectangleSuper {
2418 int height ;
2519
2620 // Default constructor with super()
27- CuboidSuper ()
28- {
21+ CuboidSuper () {
2922 super (); // Calls the default constructor of RectangleSuper
3023 height =1 ;
3124 }
3225
33- CuboidSuper (int h )
34- {
26+ CuboidSuper (int h ) {
3527 super ();
3628 height =h ;
3729 }
3830
39- CuboidSuper (int l , int b ,int h )
40- {
31+ CuboidSuper (int l , int b ,int h ) {
4132 super (l ,b );
4233 height =h ;
4334 }
4435
45- int volume ()
46- {
36+ int volume () {
4737 return length *breadth *height ;
4838 }
4939}
5040
51- public class ThisVSSuperIMP
52- {
53- public static void main (String [] args )
54- {
41+ public class ThisVSSuperIMP {
42+ public static void main (String [] args ) {
5543 CuboidSuper c = new CuboidSuper (5 ,3 ,7 );
5644 System .out .println ("Volumne of Cuboid: " +c .volume ());
5745 }
58- }
46+ }
You can’t perform that action at this time.
0 commit comments