I\'m trying to figure out the difference between
Groovy:
def name = \"stephanie\"
Java:
Object name = \"stephanie\"
Per se, there is not much difference between those two statements; but since Groovy is a dynamic language, you can write
def name = "Stephanie"
println name.toUpperCase() // no cast required
while you would need an explicit cast in the Java version
Object name = "Stephanie";
System.out.println(((String) name).toUpperCase());
For that reason, def
makes much more sense in Groovy than unfounded use of Object
in Java.
You can experiment with groovy in the groovy web console http://groovyconsole.appspot.com/
Your initial groovy date example works.