-
-
Save orekyuu/a1ddc8fe0edd39e2a499 to your computer and use it in GitHub Desktop.
突然のJavaScript
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 { | |
@SuppressWarnings("unchecked") | |
public static void main(String[] args) { | |
for(javax.script.ScriptEngineManager manager : new javax.script.ScriptEngineManager[]{new javax.script.ScriptEngineManager()}) { | |
for(javax.script.ScriptEngine js : new javax.script.ScriptEngine[]{manager.getEngineByName("js")}) { | |
try { | |
if(js.eval("function fizzbuzz(a){" + | |
"if (a % 3 == 0 && a % 5 == 0) {print('FizzBuzz')}" + | |
"else if(a % 3 == 0) {print('Fizz')}" + | |
"else if(a % 5 == 0) {print('Buzz')}" + | |
"else {print(a)}" + | |
"}") == null){} | |
if(js.eval("var i = 0") == null) {} | |
if(js.eval("while(i < 100) { fizzbuzz(i++)}") == null){} | |
} catch (javax.script.ScriptException e) { | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment