Created
February 27, 2014 07:29
-
-
Save zakki/9245879 to your computer and use it in GitHub Desktop.
FizzBuzz
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 Foo { | |
public static void main(String[] args) { | |
try { | |
if (new javax.script.ScriptEngineManager().getEngineByExtension("js").eval( | |
"var i = 1\n" + | |
"while (i < 100) {\n" + | |
"if (i % 15 == 0) println('FizzBuzz')\n" + | |
"else if (i % 3 == 0) println('Fizz')\n" + | |
"else if (i % 5 == 0) println('Buzz')\n" + | |
"else println(i)\n" + | |
"i++\n" + | |
"}\n" | |
) == null) { | |
} | |
} catch (javax.script.ScriptException e) { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment