Browsing tag:


Kotlin Interface Examples

Interface define contract for classes. An interface is similar to a class just that, it’s a collection of abstract methods and variables. Essentially Interfaces are one level more abstract than abstract classes. Let’s say we have an interface called Driveable. interface Driveable { fun drive() // declaring ‘abstract’ is implicit and unnecessary } we can then have […]

OOP: What is an Interface?

An interface is a collection of abstract methods. It is a reference type in Java/Kotlin. It is similar to class. A class implements an interface, thereby inheriting the abstract methods of the interface. [tabs type=”horizontal”] [tabs_head] [tab_title] Java Code [/tab_title] [tab_title] Kotlin Code [/tab_title] [/tabs_head] [tab] public class HelloWorld { class Example implements InterfaceExample{ @Override public […]