Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import java.lang.System;
- class A {
- public A() {
- System.out.println("1");
- m1();
- }
- public A(int i) {
- System.out.println("2");
- }
- public A(A a) {
- System.out.println("3");
- }
- public void m1() {
- System.out.println("4");
- }
- }
- class B extends A{
- A a;
- public B(A a) {
- System.out.println("5");
- }
- public B() {
- this(new A(0));
- System.out.println("6");
- }
- @Override
- public void m1() {
- System.out.println("7");
- }
- }
- public class Main {
- public static void main(String[] args) {
- A a = new B();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement