{"id":77035,"date":"2020-02-25T17:32:24","date_gmt":"2020-02-25T12:02:24","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77035"},"modified":"2020-02-25T17:32:24","modified_gmt":"2020-02-25T12:02:24","slug":"java-interface","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/java-interface\/","title":{"rendered":"Java Interface &#8211; What makes it different from a Class?"},"content":{"rendered":"<p>You might have used an ATM machine to withdraw or deposit the payment, or for fund transfer and account information inquiries. From the perspective of programming, an interface is between two software components.<\/p>\n<p>We have directly or indirectly made the use of interfaces in our programs. But we do not know the exact meaning and the use of an Interface in Java.<\/p>\n<p>Today in this article, we will explore the concept of the interface in Java. An Interface, in general, is a medium through which two systems interact with each other.<\/p>\n<h3>Interfaces in Java<\/h3>\n<p>In Java, an <strong>interface<\/strong> is a blueprint or template of a class. It is much similar to the Java class but the only difference is that it has abstract methods and static constants.<\/p>\n<p>There can be only abstract methods in an interface, that is there is no method body inside these abstract methods. The class that implements the interface should be abstract, otherwise, we need to define all the methods of the interface in the class.<\/p>\n<p><em><strong>Before moving ahead in this article it is recommended for you to take a quick revision on <a href=\"https:\/\/techvidvan.com\/tutorials\/java-class\/\">Classes in Java<\/a> with Techvidvan.<\/strong><\/em><\/p>\n<h3>Important points about Interface in Java<\/h3>\n<ul>\n<li>Interfaces are one of the core concepts of Java programming which are majorly used in Java design patterns.<\/li>\n<li>An interface provides specifications of what a class should do or not and how it should do. An interface in Java basically has a set of methods that class may or may not apply.<\/li>\n<li>It also has capabilities to perform a function. The methods in interfaces do not contain any body.<\/li>\n<li>These abstract methods are implemented by classes before accessing them.<\/li>\n<li>An interface in Java is a mechanism which we mainly use to achieve abstraction and multiple inheritances in Java.<\/li>\n<li>An interface provides a set of specifications that other classes must implement.<\/li>\n<li>We can implement multiple Java Interfaces by a Java class. All methods of an interface are implicitly public and abstract. The word abstract means these methods have no method body, only method signature.<\/li>\n<li>Java Interface also represents the IS-A relationship of inheritance between two classes.<\/li>\n<li>An interface can inherit or extend multiple interfaces.<\/li>\n<li>We can implement more than one interface in our class.<\/li>\n<li>Since Java 8, we can have static and default methods in an interface.<\/li>\n<li>Since Java 9, we can also include private methods in an interface.<\/li>\n<\/ul>\n<h3>Differences between Interface and Class in Java<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/difference-between-class-and-interface-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77214\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/difference-between-class-and-interface-in-java.jpg\" alt=\"Difference between class and interface in java\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<ul>\n<li>Unlike a class, you cannot instantiate or create an object of an interface.<\/li>\n<li>All the methods in an interface should be declared as abstract.<\/li>\n<li>An interface does not contain any constructors, but a class can.<\/li>\n<li>An interface cannot contain instance fields. It can only contain the fields that are declared as both static and final.<\/li>\n<li>An interface can not be extended or inherited by a class; it is implemented by a class.<\/li>\n<li>An interface cannot implement any class or another interface.<\/li>\n<\/ul>\n<p><strong>Syntax of declaring Interfaces in Java:<\/strong><\/p>\n<p>To declare an interface, the interface keyword is used. Here is a syntax to declare an interface:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">interface interface-name\n{\n  \/\/abstract methods\n}<\/pre>\n<p><strong>Example:<\/strong><\/p>\n<p>Following is an example of an interface:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/Filename: NameOfInterface.java\n\n                    import java.lang.*;\n                    \/\/ Any number of import statements\n\n                    interface NameOfInterface\n                    {\n                           \/\/ Any number of final, static fields\n                           \/\/ Any number of abstract method declarations\n                    }<\/pre>\n<p><strong>Example:<\/strong><\/p>\n<p>\/\/Filename : Animal.java<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">interface Animal\n{\n   public void eat();\n   public void travel();\n}<\/pre>\n<h3>Properties of a Java Interface<\/h3>\n<p>An Interface has the following properties \u2212<\/p>\n<ul>\n<li>An interface is implicitly abstract. While declaring an interface, you do not need to use the keyword abstract.<\/li>\n<li>Each method of an interface is also implicitly abstract, so we need not use the abstract keyword while declaring methods inside an interface.<\/li>\n<li>Each method in an interface is implicitly public.<\/li>\n<li>All variables defined in an interface are public, static, and final. In other words, interfaces can declare only constants, not instance variables.<\/li>\n<\/ul>\n<h3>Advantages of an Interface in Java<\/h3>\n<ul>\n<li>Use interfaces to achieve data abstraction.<\/li>\n<li>We also use them to support the functionality of multiple inheritances in Java.<\/li>\n<li>We also use them for gaining loose coupling.<\/li>\n<\/ul>\n<p><em><strong>Hold On! <\/strong><\/em><em><strong>It&#8217;s the right time to take a deep dive into the concept of <a href=\"https:\/\/techvidvan.com\/tutorials\/java-inheritance\/\">Inheritance in Java with some real-life examples.<\/a><\/strong><\/em><\/p>\n<p><em><strong>Note:<\/strong> The Java compiler automatically adds the public and abstract keywords before the methods of an interface. It also adds public, static and final keywords before the data members. It is illustrated in the image below:<\/em><\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/Automatic-Conversion-of-Java-Interface-Methods-by-Compiler.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77212\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/Automatic-Conversion-of-Java-Interface-Methods-by-Compiler.jpg\" alt=\"Conversion of Java Interface and Methods\" width=\"926\" height=\"402\" \/><\/a><\/p>\n<h3>Implementing Interfaces in Java<\/h3>\n<p>A class implementing an interface can be thought of as the class assigning a contract. This means that the class agrees to perform the specific behaviors of the interface. Unless a class is declared as abstract, it should perform all the behaviors of the interface.<\/p>\n<p>In order to implement an interface, a class uses the implements keyword. The implements keyword appears in the class declaration after the extends portion of the declaration.<\/p>\n<p><strong>Code to understand Interfaces in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.interfaces;\ninterface Polygon\n{\n  \/\/declaring variables of the interface\n  public static final int side = 5,length = 4,breadth = 8;\n  \/\/declaring interface methods(without a method body)\n  public void getName();\n  public void getNumberOfSides();\n  public void getArea();\n  public void getPerimeter();\n}\n\n\/\/ Rectangle class \"implements\" the Polygon interface\nclass Rectangle implements Polygon\n{\n  public void getName()\n  {\n    \/\/ The body of getName() is provided here\n    System.out.println(\"The name of the Polygon is: Rectangle\");\n  }\n  public void getNumberOfSides()\n  {\n    \/\/ The body of getNumberOfSides() is provided here\n    System.out.println(\"There are 4 sides in a Rectangle\");\n  }\n  public void getArea()\n  {\n    \/\/ The body of getArea() is provided here\n    System.out.println(\"The Area of Rectangle is: \" +length*breadth);\n  }\n  public void getPerimeter()\n  {\n    \/\/ The body of getPerimeter() is provided here\n    System.out.println(\"The Perimeter of Rectangle is: \" +2*(length + breadth));\n  }\n}\n\n\/\/Square class \"implements\" the Polygon interface\nclass Square implements Polygon\n{\n  public void getName()\n  {\n    \/\/ The body of getName() is provided here\n    System.out.println(\"\\nThe name of the Polygon is: Square\");\n  }\n  public void getNumberOfSides()\n  {\n    \/\/ The body of getNumberOfSides() is provided here\n    System.out.println(\"There are 4 sides in a Rectangle\");\n  }\n  public void getArea()\n  {\n    \/\/ The body of getArea() is provided here\n    System.out.println(\"The Area of Square is: \" +side * side);\n  }\n  public void getPerimeter()\n  {\n    \/\/ The body of getPerimeter() is provided here\n    System.out.println(\"The Perimeter of Square is: \" +4*side);\n  }\n}\n\nclass InterfaceDemo\n{\n  public static void main(String[] args)\n  {\n    Rectangle rectangle = new Rectangle(); \/\/ Create a Rectangle object\n    Square square=new Square(); \/\/ Create a Square object\n\n    \/\/calling methods of class Rectangle\n    rectangle.getName();\n    rectangle.getNumberOfSides();\n    rectangle.getArea();\n    rectangle.getPerimeter();\n\n    \/\/ calling methods of class Square\n    square.getName();\n    square.getNumberOfSides();\n    square.getArea();\n    square.getPerimeter();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">The name of the Polygon is: Rectangle<br \/>\nThere are 4 sides in a Rectangle<br \/>\nThe Area of Rectangle is: 32<br \/>\nThe Perimeter of Rectangle is: 24<br \/>\nThe name of the Polygon is: Square<br \/>\nThere are 4 sides in a Rectangle<br \/>\nThe Area of Square is: 25<br \/>\nThe Perimeter of Square is: 20<\/div>\n<h3>Extending Interfaces<\/h3>\n<p>As a class can extend another class, similarly an interface can extend another interface. The extends keyword is used to extend or inherit an interface. The derived interface inherits the methods of the parent interface.<\/p>\n<p>The following Person interface is extended by Student and Teacher interfaces.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/ Filename: Person.java\npublic interface Person\n{\n       public void setName(String name);\n       public void setAge(int age);\n}\n\n\/\/ Filename: Student.java\npublic interface Student extends Person\n{\n       public void marks(int marks);\n       public void getEnrollmentNumber(int roll);\n       public void yearOfPassing(int year);\n}\n\n\/\/ Filename: Teacher.java\npublic interface Teacher extends Person\n{\n       public void teacherId(int id);\n       public void salary(int salary);\n       public void assignedClasses(int number);\n       public void subject(String subject);\n}<\/pre>\n<p>The Teacher interface has four methods, but it inherits two from the Person interface; thus, a class that implements the Teacher interface needs to implement all the six methods. Similarly, a class that implements the Student interface needs to define the three methods from Student and the two methods from Person.<\/p>\n<h3>Extending Multiple Interfaces<\/h3>\n<p>We know that a Java class can only extend one parent class, as Multiple inheritances is not possible with the classes. Interfaces are similar to Java classes but an interface can extend more than one parent interface.<\/p>\n<p>The multiple parent interfaces are declared in a comma-separated list after using the keyword <strong>extends.<\/strong><\/p>\n<p><strong>For example, if the Dog interface extended both Animal and Pet, it would be declared as:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">public interface Dog extends Pet, Animal<\/pre>\n<h3>Relationship Between Classes and Interface<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/Relationship-between-Class-and-Interface-in-Java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77213\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/02\/Relationship-between-Class-and-Interface-in-Java.jpg\" alt=\"\" width=\"738\" height=\"370\" \/><\/a><\/p>\n<p>In the above figure, we can see that a class can extend another class, a class can implement an interface, and an interface can extend another interface.<\/p>\n<p><strong>New features added in interfaces from JDK 8 version<\/strong><\/p>\n<ul>\n<li>Before JDK 8, we could not define the static methods in interfaces. But form JDK 8, we can define the static methods in interfaces that which we can call independently without creating an object.<\/li>\n<li>Another feature added from JDK 8 is that we can now add default implementation for methods of an interface. Suppose we want to add new functionality to an existing interface, So we will give a default body for the newly added functions with the help of default implementation. This will not affect the old codes of the interface.<\/li>\n<\/ul>\n<p><strong>New features added in interfaces from JDK 9 version<\/strong><\/p>\n<ul>\n<li>From the JDK 9 version onwards we can also include private methods, static methods, or private static methods in the interfaces.<\/li>\n<\/ul>\n<h3>Nested Interfaces<\/h3>\n<p>An interface that is declared inside another interface or class is called a nested interface or an inner interface.<\/p>\n<p>The Nested Interface cannot be accessed directly. We mainly use a nested interface to resolve the namespace by grouping related interfaces or related interfaces and classes together.<\/p>\n<p>We use the name of the outer class or outer interface followed by a dot ( . ), followed by the interface name to call the nested interface.<\/p>\n<p><em><strong>Get to know more about <a href=\"https:\/\/techvidvan.com\/tutorials\/java-inner-class\/\">Inner Classes in Java<\/a> you didn&#8217;t know about.<\/strong><\/em><\/p>\n<p>For Example, The <strong>Tutorial<\/strong> interface is present inside the <strong>Techvidvan<\/strong> interface. Then, we can access the Tutorial interface by calling Techvivdan.Tutorial<\/p>\n<p><strong>Some points about Nested Interface:<\/strong><\/p>\n<ul>\n<li>You do not need to declare the nested interfaces as static as they are &#8216;static&#8217; by default.<\/li>\n<li>You can assign any access modifier to Nested interfaces declared inside the class But the nested interface inside interface is implicitly &#8216;public&#8217;.<\/li>\n<\/ul>\n<h3>Tagging or Marker Interfaces in Java<\/h3>\n<p>A Tag Interface or a Marker Interface is an empty interface. These interfaces are just a tag that does not contain any fields or methods. The Tag interfaces are implemented by a class to claim membership in a set.<\/p>\n<p>For example, if a class implements the EventListener interface, it is claiming to be EventListener.It is demanding to become a member of the set of EventListener classes.<\/p>\n<p>Basically, these Tag interfaces are most useful to the <a href=\"https:\/\/www.oracle.com\/java\/technologies\/javase-downloads.html\">Java<\/a> Virtual Machine. We can also create our own marker or tag interfaces to categorize our code. It improves the readability of our Java code.<\/p>\n<p><strong>Syntax of writing tag interfaces<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">    package java.util;\n    public interface Serializable\n    {\n        \/\/ nothing here\n    }<\/pre>\n<p>or,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package java.util;\npublic interface EventListener\n{\n    Nothing inside the tag interface\n}\n<\/pre>\n<h3>Summary<\/h3>\n<p>Interfaces are the blueprint of classes but are not exactly the same as that of classes. Both are different in many aspects. In general words, we can say the interfaces have abstract methods that have no implementation.<\/p>\n<p>Coming to the end of this article, we covered the basic concept of interfaces in Java and learned how to implement them in Java. We also learned how to extend them and use multiple interfaces using examples and programs. This article will surely help you in your future programming.<\/p>\n<p>Thank you for reading our article. Do share our article on Social Media.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might have used an ATM machine to withdraw or deposit the payment, or for fund transfer and account information inquiries. From the perspective of programming, an interface is between two software components. We&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77214,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[1894,1895,1896,1897,1898,1899,1900,1901,1902],"class_list":["post-77035","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-advantages-of-interface-in-java","tag-comparision-of-interface-and-class","tag-extending-interfaces","tag-extending-multiple-interfaces","tag-implementing-interfaces-in-java","tag-interface-in-java","tag-java-interface","tag-java-interface-properties","tag-relationship-between-classes-and-interface"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Interface - What makes it different from a Class? - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn the basic concept of Java Interface &amp; explore how to implement them in Java &amp; how to use multiple interface in Java using coding examples and programs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/java-interface\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Interface - What makes it different from a Class? - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn the basic concept of Java Interface &amp; explore how to implement them in Java &amp; how to use multiple interface in Java using coding examples and programs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/java-interface\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-25T12:02:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Interface - What makes it different from a Class? - TechVidvan","description":"Learn the basic concept of Java Interface & explore how to implement them in Java & how to use multiple interface in Java using coding examples and programs.","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:\/\/techvidvan.com\/tutorials\/java-interface\/","og_locale":"en_US","og_type":"article","og_title":"Java Interface - What makes it different from a Class? - TechVidvan","og_description":"Learn the basic concept of Java Interface & explore how to implement them in Java & how to use multiple interface in Java using coding examples and programs.","og_url":"https:\/\/techvidvan.com\/tutorials\/java-interface\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-02-25T12:02:24+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Java Interface &#8211; What makes it different from a Class?","datePublished":"2020-02-25T12:02:24+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/"},"wordCount":1525,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg","keywords":["Advantages of Interface in Java","Comparision of Interface and Class","Extending Interfaces","Extending Multiple Interfaces","Implementing Interfaces in Java","Interface in Java","Java Interface","Java Interface Properties","Relationship Between Classes and Interface"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/java-interface\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/","url":"https:\/\/techvidvan.com\/tutorials\/java-interface\/","name":"Java Interface - What makes it different from a Class? - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg","datePublished":"2020-02-25T12:02:24+00:00","description":"Learn the basic concept of Java Interface & explore how to implement them in Java & how to use multiple interface in Java using coding examples and programs.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/java-interface\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/02\/difference-between-class-and-interface-in-java.jpg","width":802,"height":420,"caption":"Difference between class and interface in java"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/java-interface\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Java Interface &#8211; What makes it different from a Class?"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=77035"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77035\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77214"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}