Created
February 27, 2013 14:04
-
-
Save dwins/5048116 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
abstract class Printer { | |
public static String message; | |
} | |
class FormalPrinter extends Printer { | |
static { | |
message = "Why hello good sir!"; | |
} | |
} | |
class CasualPrinter extends Printer { | |
static { | |
message = "Yo dawg what up?!"; | |
} | |
} | |
public class Print { | |
public static void main(String[] args) { | |
FormalPrinter formalPrinter = new FormalPrinter(); | |
CasualPrinter casualPrinter = new CasualPrinter(); | |
System.out.println(formalPrinter.message); | |
System.out.println(casualPrinter.message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment