Interface
Interface blueprint of class.
■ The main purpose of an interface is providing
additional information and behaviors to any class that needs it
■ The other way to achieve abstraction in java is via interface
■ An interface is not a class, but acts similar,
can be super type to a class
■ To create an interface:the keyword interface is used instead of class
■ Inheritance allows only one parent class,
but it is possible to implement multiple interfaces to a class
■ It’s possible to extend interfaces to other interfaces.
■ there is only one access modifier allowed in interface ==> public
*Interface can have: variable:(static & final by default),
methods: (abstract methods, static methods, default method)
*Interface cannot have: constructor, instance variable
instance methods, blocks
extends vs implements: both are used for inheriting
extends: class extends class, interface extends interface
(A class can inherit from one class only (extends)
implements: class implements interface1, Interface2 …
(A class can inherit multiple interfaces (implements)
**RemoteWebDriver implements WebDriver,
/ | \
chrome firefox opera
WebDriver driver = new ChromeDriver(); =>Interface
TakeScreenShot,JavaScriptExecuter=>Interface
List and Set also interface. You cannot create object in interface