Suppose we have the following method:
def myMethodWithParameters(param1, def param2, Object param3) {
...
}
What are the differences between using the def keyword and using Object as type for an argument?
What are the differences between using the def keyword and not using any type/keyword for an argument?
What I know so far and does not completely answer the question:
def
keyword is used to allow dynamic types. So you can even put anObject[]
in it.def
keyword can be used to make variables available only in current scope instead of globally