WebDriver driver = new FirefoxDriver();
(depend on which browser do you use. To learn how can use other browsers like chrome and ie, refer below post.
Working with Mozilla Firefox, google chrome and Internet Explorer in Selenium WebDriver (link))
Now, in above line, WebDriver is an interface. FirefoxDriver is a class. driver is instance. In other words, Instance of FirefoxDriver() (which is a class) is created and is stored in instance variable called “driver”.
To remember, An Interface contains empty methods that have been defined but not implemented. These methods can be implemented by anyone.
FirefoxDriveris a class that has been written specifically for the Firefox browser. It has methods that are implemented and it can be instantiated. It can perform all functions (or methods) on the Firefox browser as defined in the interface WebDriver.
Above image best describes what we are reading in the post.
Do post your questions if you have any.