Permalink
Browse files

Add Java version.

  • Loading branch information...
1 parent 2e9b56c commit 90d1346d49a60c1e9a4797d178ed7b03c72ee23a Jonas Westerlund committed Nov 23, 2011
Showing with 18 additions and 0 deletions.
  1. +1 −0 java/README.md
  2. +17 −0 java/Subject.java
View
@@ -0,0 +1 @@
+`javac Subject.java && java Subject`.
View
@@ -0,0 +1,17 @@
+import java.util.regex.*;
+
+public final class Subject {
+ public static void main (String[] arguments) {
+ while (true) {
+ subject = isDead(subject);
+ System.out.print(subject);
+ }
+ }
+ private static String isDead(String subject) {
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(subject);
+ return matcher.replaceAll(subject);
+ }
+ private static String subject = "[Subject] is dead, long live [Subject]";
+ private static String regex = "\\[Subject\\]";
+}

0 comments on commit 90d1346

Please sign in to comment.