Last active
September 26, 2016 16:14
-
-
Save Wicowyn/4ba481b0afbdf84b88ce6c0045d4e457 to your computer and use it in GitHub Desktop.
Java instance création
This file contains 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
Property logger 1 | |
Upper class constructor | |
Property logger 2 | |
Sub class constructor |
This file contains 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 Main { | |
public static void main(String[] args) { | |
new SubClass(); | |
} | |
} |
This file contains 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
//PropertyLogger.java | |
public class PropertyLogger { | |
public PropertyLogger(int count) { | |
System.out.println("Property logger "+count); | |
} | |
} |
This file contains 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 SubClass extends UpperClass { | |
PropertyLogger l2 = new PropertyLogger(2); | |
public SubClass() { | |
System.out.println("Sub class constructor"); | |
} | |
} |
This file contains 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 UpperClass { | |
PropertyLogger l1 = new PropertyLogger(1); | |
public UpperClass() { | |
System.out.println("Upper class constructor"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Je m'attendais à :
Où comment re-découvrir Java x)