Hello Sir!
Attaching a link in which code is already written you just need to add the Main method so I can run the program. Thanks
https://drive.google.com/file/d/12ywHMF2l0bnQihN_SSFRXFMy1PLc3GwN/view?usp=sharing
class A
{
int x, y;
void display()
{
System.out.println("Class A values="+x+" "+y); ;
}
}
class B extends A
{
int z;
void show()
{
System.out.println("Inside Class B values="+x+" "+y+" "+z);
}
}
public class Main{
public static void main(String args[]) {
B b = new B();
b.x=1;
b.y=2;
b.z=3;
b.display();
b.show();
}
}
Comments
Leave a comment