Sidharth,
WebDriver is an interface which RemoteWebDriver ( the mother of all WebDriver implementations ) implements. That explains why one is able to assign a concrete implementation object to the interface reference [ WebDriver driver = new FirefoxDriver() ] because all browser web driver implementations such as FirefoxDriver, ChromeDriver, InternetExplorerDriver etc., extend RemoteWebDriver and thus indirectly implement the WebDriver interface [ which is basically a contract that anyone who claims to support browser interaction has to adhere to ]
All said and done, there is NOTHING in Java that states that you cannot create an interface Object. Its called anonymous objects and Java very much supports it [ But then again, that’s completely out of scope of discussion in this forum, because we focus here on WebDriver/Selenium and not Java questions ]
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"