hi everyone, There are many interfaces in jave. For example consider public interface RequestDispatcher. In this interface, there are 2 methods by name include() and forward(). We know that both the methods do some work when they are called. But seeing the interface, they look empty. Somewhere the implementation would have written. How to find , where the implementation has written? Please suggest me here. cheers.
In the example you've given, RequestDispatcher will be implemented by web containers applying to the official Servlet Specification. So if you want to check the content of its implementation, you'll have to dig into the container's source.
Hii Bobz , yes you are thinking in rigth way ,there is implementation for each method in RequestDispathcher interface but it is in RequestDispathcherImpl.class; which you can find on your server lib directory.
If you write an interface called MyInterface you can then implement it in one or more classes. The compiler will then require you to either implement the methods in MyInterface, or change your class to be abstract.
Does that make sense so far? If so, I hope you're ready to ask why we do this kind of thing.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi