WebDriver is an interface which can be implemented by the class which implements it.
ChromeDriver,geckoDriver,IEDriver these are the class which implements the webdriver interface .
Since webdriver is an interface it contians all the abstract methods .These methods are implemented by the class implementing the interface .
Hence in our code we write WebDriver driver = new ChromeDriver();
we can also write ChromeDriver driver = new ChromeDriver();
But here we can only invoke methods that are of chrome driver.
Whereas in WebDriver driver = new ChromeDriver();
we can invoke the methods of both chrome driver and webdriver