{filelink=945}
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class RefernceScript {
public static void main(String args[]) {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine moteur = manager.getEngineByName("javascript");
try {
moteur.put("salutation", "Bonjour");
moteur.eval("var affichage = '';for (i = 0; i <= salutation.length; i++) {"
+ " affichage = salutation.charAt(i)+'\n'+ affichage" + "}");
String salutation = (String) moteur.get("affichage");
System.out.println(salutation);
} catch (ScriptException e) {
System.err.println(e);
}
}
}
/*
r
u
o
j
n
o
B
*/