Java Question
class Test4A {
protected int x;
public Test4A() { x = 100;}
public Test4A(int x) { this.x = x;}
}
public class Test4B extends Test4A {
int x;
public Test4B() {x = 200;}
public Test4B(int x, int y) {
super(x);
this.x = y;
public static void main(String[] args) {
Test4A a = new Test4A();
Test4B b = new Test4B(10, 20);
System.out.println(a.x);
System.out.println(b.x);
Test4A c = b;
System.out.println(c.x);
System.out.println(c.y);
Please explain in detail Test4A c = b
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here