The key here is Groovy, check out its Wikipedia entry.
Very Basically, you could say that Groovy is "on top" of Java and that Gremlin is on top of Groovy.
While using Groovy you have access to a new more compact syntax (but it really is not the only feature) and also to the full power of Java since you can use any Java library available. The most interesting feature though, and what really is important in the context of Gremlin is that Groovy is a scripting language for Java. You write Groovy/Java code as if you were using some shell script and the code you write is dynamically compiled and executed on the JVM.
Now, what the developers of Gremlin have done is "extend" the syntax of Groovy with some graph traversal related syntax (as well as provide a graph traversal API of course). They do not forbid you to use Gremlin from Java. You may still use Gremlin in a "standard" Java application, but as the example shows it, it is not its primary intended usage.
To resume, in order to use Gremlin (from the minimum requirement to the most optimal requirement):
- You have to know Groovy or Java (or you will need to :-)
- If you are a long-time pure Java programmer you have the advantage of knowing parts of the JDK, and many other existing libraries or frameworks such as Apache Commons, or Spring for example (Spring supports Groovy!). You don't know the more compact Groovy syntax, but you will be alright.
- If you know Groovy...you most probably know Java :-) but not necessarily. You will do alright.
- If you both know Java and Groovy, you are God. No, not really. But you will have no trouble at all.
Note that for points 2-3-4 you will of course need to go through Gremlin's documentation.