Java - 8 : dynamic method arguments

This is the groovy code I am having:

def add(a, b) {
  return a+b
}

println add(1,2) // prints 3

println add("Suganthan","Madhavan")​ // prints SuganthanMadhavan

Where the groovy identifies the method argument on run. Would this runtime method argument detection is possible in Java-8?

Is that atleast possible through MethodHandle ?

Upvotes: 2

Views: 496

Answers (1)

Lodewijk Bogaards
Lodewijk Bogaards

Reputation: 19987

No. Groovy is a dynamically compiled language. Java is a statically compiled language.

Upvotes: 2

Related Questions