Ana sayfa
/
Teknoloji
/
Q4. Write the Exact output of the given program into the box. public class A public int a; private int b; protected int c; public static int d -0; A(int m,int n) f a=m; b=n;System.out.println("A is created"); d++; public void showb ) [ System.out.println ("b=+b); } public class B extends A public int a; private int p; B(int z1,int z2 int 23,int z4,int 25) super(z1,22); a=23; C=24;p=25; System.out.println("B is created"); public void showd ()System.out.println ("d=*+d ); ] public void showa ([ System.out.println ("a's are: "ta:" "super.a); ] public class Main square

Soru

Q4. Write the Exact output of the given program into the box.
public class A
public int a;
private int b;
protected int c;
public static int d -0;
A(int m,int n)
f
a=m;
b=n;System.out.println("A is created"); d++;
public void showb )
[ System.out.println ("b=+b); }
public class B extends A
public int a;
private int p;
B(int z1,int z2 int 23,int z4,int 25)
super(z1,22); a=23; C=24;p=25;
System.out.println("B is created");
public void showd ()System.out.println ("d=*+d ); ]
public void showa ([ System.out.println ("a's are: "ta:" "super.a); ]
public class Main
square

Q4. Write the Exact output of the given program into the box. public class A public int a; private int b; protected int c; public static int d -0; A(int m,int n) f a=m; b=n;System.out.println("A is created"); d++; public void showb ) [ System.out.println ("b=+b); } public class B extends A public int a; private int p; B(int z1,int z2 int 23,int z4,int 25) super(z1,22); a=23; C=24;p=25; System.out.println("B is created"); public void showd ()System.out.println ("d=*+d ); ] public void showa ([ System.out.println ("a's are: "ta:" "super.a); ] public class Main square

Çözüm

3.2299 Voting
avatar
Berkay
Uzman · 3 yıl öğretmeni
Uzman doğrulaması

Cevap

The given program has several syntax errors and missing semicolons. Here is the corrected version of the program:<br /><br />```java<br />public class A {<br /> public int a;<br /> private int b;<br /> protected int c;<br /> public static int d = 0;<br /><br /> public A(int m, int n) {<br /> a = m;<br /> b = n;<br /> System.out.println("A is created");<br /> d++;<br /> }<br /><br /> public void showb() {<br /> System.out.println("b=" + b);<br /> }<br />}<br /><br />public class B extends A {<br /> public int a;<br /> private int p;<br /><br /> public B(int z1, int z2, int z3, int z4, int z5) {<br /> super(z1, z2);<br /> a = z3;<br /> c = z4;<br /> p = z5;<br /> System.out.println("B is created");<br /> }<br /><br /> public void showd() {<br /> System.out.println("d=" + d);<br /> }<br /><br /> public void showa() {<br /> System.out.println("a's are: " + a + " " + super.a);<br /> }<br /><br /> public static void main(String[] args) {<br /> B obj = new B(1, 2, 3, 4, 5);<br /> obj.showd();<br /> obj.showa();<br /> }<br />}<br />```<br /><br />The output of the corrected program will be:<br /><br />```<br />B is created<br />d=1<br />a's are: 3 1<br />```
Derecelendirmek için tıklayın: