Created
August 20, 2012 12:43
-
-
Save ajduke/3403742 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SuperClass { | |
public SuperClass() { | |
System.out.println("SuperClass Constr with no params"); | |
} | |
public SuperClass(int a, int b) { | |
System.out.println("SuperClass Constr with two params"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SubClasss extends SuperClass { | |
public SubClasss() { | |
super(5, 4); | |
System.out.println("SubClasss Constr with no params"); | |
} | |
public SubClasss(int a) { | |
System.out.println("SubClasss Constr with one params"); | |
} | |
public static void main(String[] args) { | |
new SubClasss(); | |
System.out.println(); | |
new SubClasss(5); | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Result of execution | |
SuperClass Constr with two params | |
SubClasss Constr with no params | |
SuperClass Constr with no params | |
SubClasss Constr with one params |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment