Let’s create an interface with two methods in it :- I1. How interface will decide which implementation to be called? I will try to explain this connection with very simple example. You may confuse an interface has no method definitions ( Except default and static concrete methods ) then how we are able to use it. When we perform a HTTP verb request, we get response as a type of Response which is an interface. This concept is even important to understand Selenium WebDriver hierarchy of classes and interfaces as well. You will be thinking why I am talking about basics of Interface in REST Assured tutorials. An interface without its implemented class is incomplete.An interface can not have static or non-static blocks.An interface neither extend nor implement a class.An interface can extend one or multiple interfaces.Multiple inheritance can be achieved using interface.A method without body will be abstract and public by default. Abstract methods are public by default. Confluence OOPs understanding, proficient in Core Java & any scripting. Data members in an Interface is public, static and final by default. Hands on experience Selenium (WebDriver, Selenium Grid), API Automation, TestNG.We can not create a constructor in an interface.From Java 8, an interface can have concrete methods as well. We can have abstract, default and static methods in an interface.We can create an interface using “interface” keyword. JAVA OOPS Concepts - Implementation of OOPS concept In SELENIUM FRAMEWORK - Part 2 1.” Interface and abstract class are ways to achieve Abstraction in Java. Methods creates the object’s interface with the outside world the buttons on the front of your television set, for example, are the interface between you and the electrical wiring on the other side of its plastic casing. Javadoc explains interface as “ Objects define their interaction with the outside world through the methods that they expose. The same concept is also applicable in OOPS (Object Oriented Programming System ) like Java. Laptop has exposed their required parts so that anybody can use it. Can I say that you and laptop are INTERFACED by screen, keypad and mouse pad? Are you worrying about how key is typed or what is internal working architecture of laptop is? You are just concerned about work to be done. You will type search queries in search box using keypad. After reading this post, You may be interested to search more topics in search box of my blog. You will be scrolling post up or down through arrow keys or mouse pad. Let’s assume you are reading this post on your laptop. You would be reading this post on a mobile or a laptop. I will strongly recommended you to go through the topic Abstraction – Hide the implementation before continuing this post. As a part of End to End REST Assured Tutorial, in this post We will learn about Interface in Java.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |