Is there a good interactive interpreter for Java, similar to Scala's? When programming, I like to try small pieces of code to see if they work like I expect before plugging them in to my main program. I would prefer an interpreter that is not based online since I often work offline.
Thanks in advance!
Since Scala runs on a JVM, why not the Scala interpreter? That's what I do when I need to test a few Java-snippets.
It's nice to have tab completion that works.
scala> System.getPropert
getProperties getProperty
scala> System.getProperty("user.home")
res0: String = c:\Users\robert
Ok, you have to know a bit about Scala syntax when you do stuff like:
scala> val testMap = new java.util.HashMap[String, java.util.List[String]]
testMap: java.util.HashMap[String,java.util.List[String]] = {}
scala> testMap.put("planets", java.util.Arrays.asList("Mars", "Jupiter", "Pluto"
))
res0: java.util.List[String] = null
scala> testMap.get("planets")
res1: java.util.List[String] = [Mars, Jupiter, Pluto]
In the past I used beanshell. It was really light and got the job done. http://www.beanshell.org/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With