Interfacing: In simple words, interfacing is communication across two or more components of a computer system by exchanging information.
xxxxxxxxxx
Interfaces specify what a class must do.
It is the blueprint of the class.
It is used to achieve total abstraction.
We are using implements keyword for interface.
Basic statement we all know in Selenium is
WebDriver driver = new FirefoxDriver();
WebDriver itself is an Interface.
So we are initializing Firefox browser
using Selenium WebDriver.
It means we are creating a reference variable
of the interface and creating an Object.
So WebDriver is an Interface and
FirefoxDriver is a class.
xxxxxxxxxx
Interfaces are Classes that contain "empty" methods that are implemented on-demand
- Implementing such a method is the same as overriding a normal class method.
- "abstract" modifier is used to prevent "instantiation" or "invocation" cause they have/are empty methods
- often used when firing events, that way same event can do multiple tasks