[url=http://java.sun.com/docs/books/tutorial/java/concepts/]Object-Oriented Programming Concepts[/url]
[url=http://www.javaworld.com/javaworld/jw-04-2001/jw-0406-java101.html]Object-oriented language basics[/url]
[url=http://sepwww.stanford.edu/sep/josman/oop/oop1.htm]Don't Fear the OOP[/url]
> What is the need of polymorphism?
Basically polymorphism is any language mechanisms that allows the same code to work with different types. There are many kinds of polymorphism but when people say polymorphism they usually mean subtyping. In Java you use class extension and interface implementation and method overriding to achieve it.
> And what is the
> need of compile time polymorphism and runtime
> polymorphism?
It's a classification of different kinds of polymorphism based on when the polymorphism can be resolved, at compile- or run-time. Basically it's a technical issue you don't have to worry much about while programming.
Subtyping is an example of runtime (or dynamic) polymorphism. The object type cannot be determined until the program is run.