Question Regarding Interfaces
I have a question.
how do interface perform some task without having body in java. For example
My doubt is include method is not implemented. so how it is performing its tasks?????
I am new to java
Re: Question Regarding Interfaces
The actual object held by rd is not a direct RequestDispatcher instance, but rather another class which implements the RequestDispatcher interface. As such it must provide an implementation of all the methods RequestDispatcher requires. This is a guarantee enforced by the compiler.
You can get the actual object type held:
Note that the code won't always output something easily decipherable or make sense (particularly when dealing with nested/anonymous classes), but it will return what implementing class object is being held.