Wednesday, 14 August 2013

Can we call method using the reference of the class

Can we call method using the reference of the class

I just started to learn java and i found out that, to call a method of
normal class we need object but for static class we do not need any object
to call we can use class reference to do that. But while coding I came
across some code which really confused me. The code is.
public class MyInterceptor extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation actionInvocation) throws Exception {
String result = actionInvocation.invoke();
Here my doubt is in the 3rd line we have a reference actionInvocation for
a class ActionInvocation and we have not used any new keyword and now
check the 4th line we used actionInvocation to access the methos invoke().
How is this possible without using new keyword? I also checked that
ActionInvocation is abstract interface.

No comments:

Post a Comment