{"id":3403,"date":"2024-11-15T17:00:39","date_gmt":"2024-11-15T17:00:39","guid":{"rendered":"https:\/\/sankhamtech.com\/index.php\/content\/india\/english\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/"},"modified":"2024-11-15T17:01:23","modified_gmt":"2024-11-15T17:01:23","slug":"understanding-interfaces-in-java","status":"publish","type":"page","link":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/","title":{"rendered":"Understanding Interfaces in Java"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"3403\" class=\"elementor elementor-3403\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ab6e674 e-flex e-con-boxed e-con e-parent\" data-id=\"ab6e674\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t<div class=\"elementor-element elementor-element-4377352 e-con-full e-flex e-con e-child\" data-id=\"4377352\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1eb135e elementor-hidden-mobile elementor-widget elementor-widget-text-editor\" data-id=\"1eb135e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"text-align: center;\"><span style=\"text-decoration: underline;\">Lessons<\/span><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c1f02b3 elementor-hidden-desktop elementor-hidden-tablet elementor-widget elementor-widget-text-editor\" data-id=\"c1f02b3\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h6 style=\"text-align: center;\"><a href=\"https:\/\/sankhamtech.com\/index.php\/content\/india\/english\/home\/free-courses\/understanding-object-oriented-programming-in-java\/\"><span style=\"text-decoration: underline;\">Lessons<\/span><\/a><\/h6>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-31cf73d elementor-hidden-mobile elementor-widget elementor-widget-darsanam_header_menu_widget\" data-id=\"31cf73d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"darsanam_header_menu_widget.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"darsanam-menu-wrapper \"><div class='hamburger-icon'><i class=\"fas fa-grip-lines\"><\/i> &nbsp; <\/div><div class=\"menu-container\"><nav class='elementor-menu'><ul class='darsanam-menu-vertical'><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/setting-up-your-development-environment\/'>Setting Up Your Development Environment<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/java-basics-syntax-variables-data-types-and-operators\/'>Java Basics - Syntax, Variables, Data Types, and Operators<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-objects-and-classes-in-java\/'>Understanding Objects and Classes in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-encapsulation-in-java\/'>Understanding Encapsulation in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-inheritance-in-java-the-is-a-relationship\/'>Understanding Inheritance in Java: The \"Is-A\" Relationship<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-constructors-in-java-inheritance\/'>Understanding Constructors in Java Inheritance<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-access-modifiers-in-java-inheritance\/'>Understanding Access Modifiers in Java Inheritance<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-polymorphism-in-java\/'>Understanding Polymorphism in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-abstract-classes-and-methods-in-java\/'>Understanding Abstract Classes and Methods in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/' style='color: #FF7700 !important'>Understanding Interfaces in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-exception-handling-in-java\/'>Understanding Exception Handling in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/java-collections-framework-list-set-map-and-their-implementations\/'>Java Collections Framework - List, Set, Map, and their implementations<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-loops-in-java-foreach-and-lambda\/'>Understanding Loops in Java: forEach and lambda<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-the-serializable-interface-in-java\/'>Understanding the Serializable Interface in Java<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-java-beans\/'>Understanding Java Beans<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><li class='darsanam-menu-item'><a href='https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/making-api-calls-in-java-a-comprehensive-guide\/'>Making API Calls in Java: A Comprehensive Guide<\/a><i class=\"menu-icon-right fas fa-angle-right\"><\/i><\/li><\/ul><\/nav><\/div><\/div>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-a537f4a e-con-full e-flex e-con e-child\" data-id=\"a537f4a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-69a1edf elementor-widget elementor-widget-text-editor\" data-id=\"69a1edf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2>Understanding Interfaces in Java<\/h2><p><\/p><p><\/p><h4 class=\"wp-block-heading\"><\/h4><h4 class=\"wp-block-heading\">Introduction to Interfaces in Java<\/h4><h4 class=\"wp-block-heading\"> <\/h4><p>In Java, an interface is a reference type that can contain only constants, method signatures, default methods, static methods, and nested types. Interfaces are similar to abstract classes, but they cannot contain any method implementation except in default or static methods. They are used to establish a contract for classes that implement them, ensuring that certain methods are always present in these classes.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Example: Database Interface<\/h4><h4 class=\"wp-block-heading\"> <\/h4><p>Let&#8217;s consider an example of a <code>Database<\/code> interface with CRUD (Create, Read, Update, Delete) operations and a method to establish a session.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Defining the Interface:<\/h5><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface Database {\n    void establishSession();\n    void createRecord();\n    void readRecord();\n    void updateRecord();\n    void deleteRecord();\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p>In this <code>Database<\/code> interface, we&#8217;ve declared five abstract methods that any implementing class must define.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Implementing the Interface:<\/h4><h4 class=\"wp-block-heading\"> <\/h4><p>Two classes, <code>MySQLDatabase<\/code> and <code>OracleDatabase<\/code>, implement the <code>Database<\/code> interface, providing specific implementations for each abstract method.<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public class MySQLDatabase implements Database {\n    public void establishSession() {\n        \/\/ MySQL-specific session establishment code\n    }\n\n    public void createRecord() {\n        \/\/ Code to create a record in MySQL\n    }\n\n    \/\/ Implementations for readRecord, updateRecord, and deleteRecord\n}\n\npublic class OracleDatabase implements Database {\n    public void establishSession() {\n        \/\/ Oracle-specific session establishment code\n    }\n\n    public void createRecord() {\n        \/\/ Code to create a record in Oracle\n    }\n\n    \/\/ Implementations for readRecord, updateRecord, and deleteRecord\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Method Implementation Enforcement<\/h4><h4 class=\"wp-block-heading\"> <\/h4><ul class=\"wp-block-list\"><li>When a class implements an interface, it is bound to provide concrete implementations for all the abstract methods declared in the interface.<\/li> <li>This enforces a standard structure while allowing different implementations in different classes. For instance, <code>MySQLDatabase<\/code> and <code>OracleDatabase<\/code> will have different code for <code>establishSession<\/code> and CRUD operations, but they must all provide these methods.<\/li><\/ul><h4 class=\"wp-block-heading\"> <\/h4><h4 class=\"wp-block-heading\">Scenarios for Using Interfaces<\/h4><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Multiple Implementations<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Scenario<\/strong>: Different classes implementing the same interface in their own unique way.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Code Example<\/strong>:<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface PaymentGateway {\n    void processPayment(double amount);\n}\n\npublic class PaypalPaymentGateway implements PaymentGateway {\n    public void processPayment(double amount) {\n        \/\/ PayPal-specific payment processing\n    }\n}\n\npublic class StripePaymentGateway implements PaymentGateway {\n    public void processPayment(double amount) {\n        \/\/ Stripe-specific payment processing\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Explanation<\/strong>: Here, <code>PaymentGateway<\/code> is an interface with a <code>processPayment<\/code> method. <code>PaypalPaymentGateway<\/code> and <code>StripePaymentGateway<\/code> are two different implementations of this interface. Each class provides its own implementation of <code>processPayment<\/code>, suitable for the respective payment service provider.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Loose Coupling<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Scenario<\/strong>: Designing systems where implementation can be easily changed without affecting other parts of the code.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Code Example<\/strong>:<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface Logger {\n    void log(String message);\n}\n\npublic class FileLogger implements Logger {\n    public void log(String message) {\n        \/\/ Log message to a file\n    }\n}\n\npublic class ConsoleLogger implements Logger {\n    public void log(String message) {\n        \/\/ Log message to the console\n    }\n}\n\npublic class Application {\n    private Logger logger;\n\n    public Application(Logger logger) {\n        this.logger = logger;\n    }\n\n    public void execute() {\n        logger.log(\"Application started\");\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Explanation<\/strong>: In this example, <code>Logger<\/code> is an interface, and <code>FileLogger<\/code> and <code>ConsoleLogger<\/code> are its implementations. The <code>Application<\/code> class is designed to use a <code>Logger<\/code> but is not tied to a specific implementation. This allows changing the logger type (file or console) without modifying the <code>Application<\/code> class, demonstrating loose coupling.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Designing APIs<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Scenario<\/strong>: Defining a set of methods that must be implemented, often used in frameworks and libraries.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Code Example<\/strong>:<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface DataRepository {\n    void save(Object data);\n    Object findById(String id);\n}\n\n\/\/ This interface can be part of a framework or library,\n\/\/ and users of the framework will provide their own implementation.\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Explanation<\/strong>: <code>DataRepository<\/code> is an interface that defines methods for data persistence. Framework users can implement this interface to work with different data storage mechanisms (like SQL databases, NoSQL databases, etc.), adhering to the defined API.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Dependency Injection<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Scenario<\/strong>: Using interfaces for injecting dependencies in frameworks or large applications.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Code Example<\/strong>:<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface EmailService {\n    void sendEmail(String address, String content);\n}\n\npublic class Application {\n    private EmailService emailService;\n\n    \/\/ EmailService is injected into the Application class\n    public Application(EmailService emailService) {\n        this.emailService = emailService;\n    }\n\n    public void notifyUser(String userAddress) {\n        emailService.sendEmail(userAddress, \"Notification message\");\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Explanation<\/strong>: <code>EmailService<\/code> is an interface, and its implementation is injected into the <code>Application<\/code> class. This enables the use of different email services without changing the <code>Application<\/code> code, following the dependency injection principle.<\/p><h4 class=\"wp-block-heading\"> <\/h4><h5 class=\"wp-block-heading\">Callback Patterns and Multiple Inheritance<\/h5><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Scenario<\/strong>: Implementing callback mechanisms or emulating multiple inheritance.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Code Example<\/strong>:<\/p><h4 class=\"wp-block-heading\"> <\/h4><pre class=\"wp-block-code\"><code>public interface OnClickListener {\n    void onClick();\n}\n\npublic class Button {\n    private OnClickListener listener;\n\n    public void setOnClickListener(OnClickListener listener) {\n        this.listener = listener;\n    }\n\n    public void simulateClick() {\n        if (listener != null) {\n            listener.onClick();\n        }\n    }\n}\n\npublic class UserInterface implements OnClickListener {\n    public void onClick() {\n        System.out.println(\"Button was clicked\");\n    }\n\n    public static void main(String[] args) {\n        Button button = new Button();\n        UserInterface ui = new UserInterface();\n\n        button.setOnClickListener(ui);\n        button.simulateClick(); \/\/ Triggers onClick in UserInterface\n    }\n}\n<\/code><\/pre><h4 class=\"wp-block-heading\"> <\/h4><p><strong>Explanation<\/strong>: Here, <code>OnClickListener<\/code> is an interface used for a callback mechanism in a UI component (<code>Button<\/code>). The <code>UserInterface<\/code> class implements this interface, allowing it to define behavior for button clicks. This demonstrates the use of interfaces in callback patterns.<\/p><h4 class=\"wp-block-heading\"> <\/h4><p>\u00a0<\/p><h4 class=\"wp-block-heading\"><\/h4><p><\/p><p><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Abstract Classes and Methods in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3335,"menu_order":9,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3403","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding Interfaces in Java - Sankham Technologies<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Interfaces in Java - Sankham Technologies\" \/>\n<meta property=\"og:description\" content=\"Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Abstract Classes and Methods in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"Sankham Technologies\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-15T17:01:23+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-interfaces-in-java\\\/\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-interfaces-in-java\\\/\",\"name\":\"Understanding Interfaces in Java - Sankham Technologies\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#website\"},\"datePublished\":\"2024-11-15T17:00:39+00:00\",\"dateModified\":\"2024-11-15T17:01:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-interfaces-in-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-interfaces-in-java\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/understanding-interfaces-in-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Content\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"India\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"English\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Free Courses\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/index.php\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/\"},{\"@type\":\"ListItem\",\"position\":7,\"name\":\"Understanding Object-Oriented Programming in Java\",\"item\":\"https:\\\/\\\/sankhamtech.com\\\/indexphp\\\/content\\\/in\\\/en\\\/home\\\/free-courses\\\/understanding-object-oriented-programming-in-java\\\/\"},{\"@type\":\"ListItem\",\"position\":8,\"name\":\"Understanding Interfaces in Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#website\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/\",\"name\":\"Sankham Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sankhamtech.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#organization\",\"name\":\"Sankham Technologies\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/sankhamtech.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/Logo-Dark-1.png\",\"contentUrl\":\"https:\\\/\\\/sankhamtech.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/Logo-Dark-1.png\",\"width\":306,\"height\":74,\"caption\":\"Sankham Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/sankhamtech.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding Interfaces in Java - Sankham Technologies","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Understanding Interfaces in Java - Sankham Technologies","og_description":"Lessons Lessons &nbsp; Setting Up Your Development Environment Java Basics &#8211; Syntax, Variables, Data Types, and Operators Understanding Objects and Classes in Java Understanding Encapsulation in Java Understanding Inheritance in Java: The &#8220;Is-A&#8221; Relationship Understanding Constructors in Java Inheritance Understanding Access Modifiers in Java Inheritance Understanding Polymorphism in Java Understanding Abstract Classes and Methods in [&hellip;]","og_url":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/","og_site_name":"Sankham Technologies","article_modified_time":"2024-11-15T17:01:23+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/","url":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/","name":"Understanding Interfaces in Java - Sankham Technologies","isPartOf":{"@id":"https:\/\/sankhamtech.com\/#website"},"datePublished":"2024-11-15T17:00:39+00:00","dateModified":"2024-11-15T17:01:23+00:00","breadcrumb":{"@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/understanding-interfaces-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sankhamtech.com\/"},{"@type":"ListItem","position":2,"name":"Content","item":"https:\/\/sankhamtech.com\/index.php\/content\/"},{"@type":"ListItem","position":3,"name":"India","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/"},{"@type":"ListItem","position":4,"name":"English","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/"},{"@type":"ListItem","position":5,"name":"Home","item":"https:\/\/sankhamtech.com\/"},{"@type":"ListItem","position":6,"name":"Free Courses","item":"https:\/\/sankhamtech.com\/index.php\/content\/in\/en\/home\/free-courses\/"},{"@type":"ListItem","position":7,"name":"Understanding Object-Oriented Programming in Java","item":"https:\/\/sankhamtech.com\/indexphp\/content\/in\/en\/home\/free-courses\/understanding-object-oriented-programming-in-java\/"},{"@type":"ListItem","position":8,"name":"Understanding Interfaces in Java"}]},{"@type":"WebSite","@id":"https:\/\/sankhamtech.com\/#website","url":"https:\/\/sankhamtech.com\/","name":"Sankham Technologies","description":"","publisher":{"@id":"https:\/\/sankhamtech.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sankhamtech.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/sankhamtech.com\/#organization","name":"Sankham Technologies","url":"https:\/\/sankhamtech.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sankhamtech.com\/#\/schema\/logo\/image\/","url":"https:\/\/sankhamtech.com\/wp-content\/uploads\/2023\/12\/Logo-Dark-1.png","contentUrl":"https:\/\/sankhamtech.com\/wp-content\/uploads\/2023\/12\/Logo-Dark-1.png","width":306,"height":74,"caption":"Sankham Technologies"},"image":{"@id":"https:\/\/sankhamtech.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/comments?post=3403"}],"version-history":[{"count":4,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3403\/revisions"}],"predecessor-version":[{"id":3407,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3403\/revisions\/3407"}],"up":[{"embeddable":true,"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/pages\/3335"}],"wp:attachment":[{"href":"https:\/\/sankhamtech.com\/index.php\/wp-json\/wp\/v2\/media?parent=3403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}