Skip to content

Instantly share code, notes, and snippets.

@karnzx
Last active February 13, 2021 04:24
Show Gist options
  • Save karnzx/24cfd33e269aabafb90f31958fa3f368 to your computer and use it in GitHub Desktop.
Save karnzx/24cfd33e269aabafb90f31958fa3f368 to your computer and use it in GitHub Desktop.
class A {
private int x;
public A(int x) {
this.x = x;
System.out.println("A");
}
public void foo() {
System.out.println(x);
}
}
class B extends A {
public B(int x) {
super(x);
System.out.println("B");
}
}
public class Inherit01 {
public static void main(String[] args) {
new B(3).foo();
System.out.println("6210110242");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment