Last active
December 21, 2015 13:49
-
-
Save peysal/6315154 to your computer and use it in GitHub Desktop.
Groovy introduction:
1) no accessors method
2) gString
3) accessing object
4) equality operator not referring to memory address extra: can change the value to make wrong assertion just to show groovy trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
String name | |
int age | |
} | |
//no accessors method | |
Person person = new Person() | |
person.name = "goku" | |
println "helloo ${person.name}" | |
assert person.name == "goku" | |
assert person["name"] == "goku" | |
person = new Person(name:"gohan") //passing constructor value | |
assert person.name == "gohan" | |
println "helloo ${person.name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment