When do we need to go for Adapter pattern? If possible give me a real world example that suits that pattern...
A very common example of the adapter pattern is done through the Service Provider Interface and is commonly used in a lot of the Java EE framework.
The reason for it is to allow different implementations of Java EE but programmers simply code to the Java EE spec rather than something implementation specific.
As opposed to something like coding directly using WebSphere classes which lock you into using WebSphere.
Or worse (from my experience), Apache HTTP Client and find out later that because you coded to that implementation rather than the normal HttpUrlConnection you have to do a lot of recoding because it does not support the current version of TLS which would've been avoided if the original developer coded to a more stable API and we just need to upgrade Java runtime.