Can you find out the error in the below code? Explainthe reason and also write correct code. [0.75]
public class X {
privateint n;
publicX(int i)
{
n=i;
}
publicvoid show()
{System.out.println(n);
}
}
public class Yextends X{
public Y()
{
}
publicvoid show()
{
super.show();
}
}
public class Test {
publicstatic void main(String[] args){
Yob=new Y();
ob.show();
}
}
Expert Answer
An answer will be send to you shortly. . . . .