5 ms·
If you're looking for a REPL for Java, try the Groovy shell (comes standard with an install of Groovy). Meant, as the name implies, for Groovy, but since Java
by elmarschraml 11y ago
If you're looking for a REPL for Java, try the Groovy shell (comes standard with an install of Groovy).
Meant, as the name implies, for Groovy, but since Java is a subset of Groovy, works fine for any Java code, too.
It's great for quickly trying out an API or library. Also makes it easy to just drop a bunch of jar files onto the classpath.
- vinay427 11y agoWhat about, for instance, the difference in multi-methods presented here? I would assume you would get different results in the Groovy REPL than in a Java compiler. http://www.groovy-lang.org/differences.html http://www.groovy-lang.org/differences.html
- cle 11y agoCan second this. At work, we have a large legacy Java codebase, and our most useful ops tool is our entire codebase and Spring beans loaded into a Groovy shell. Extremely convenient. Groovy is largely compatible with Java, but it also has shorthand notations (splat operator, elvis operator, closures, optional typing) and collections that are much more expressive than Java.
- vorg 11y ago> Java is a subset of Groovy Java is not a subset of Groovy. Some syntax valid in both will behave differently in each, e.g. default visibility, and how == behaves.