0

I have JavaScript I need to execute, String.fromCharCode() to be specific. I would like to save this result in a Java string accessible in the rest of my program.

I have I've started working with the Nashorn Script Engine. I can evaluate the JavaScript, but I'm unsure of how to save the result in my Java object.

Object result = engine.eval("print(String.fromCharCode(+((!![]+!![]+!+[]+!![]+!+[]+!+[]+!![]+!![]+[])+(+!!+[]))));");

The result of this is "P"

How can I access this answer from Java?

Kristoff
  • 167
  • 3
  • 13

0 Answers0