{"id":77111,"date":"2020-03-07T10:57:26","date_gmt":"2020-03-07T05:27:26","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77111"},"modified":"2020-03-07T10:57:26","modified_gmt":"2020-03-07T05:27:26","slug":"abstract-class-vs-interface","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/","title":{"rendered":"Abstract Class vs Interface &#8211; Wipe Out all your Doubts!"},"content":{"rendered":"<p>In Java, the Abstract classes and interfaces are fundamental building blocks as they both are used to implement one of the essential concepts of Object-Oriented Programming that is, Abstraction.<\/p>\n<p>Though both of them are used for Abstraction, they differ from each other, and we cannot use them interchangeably. We will compare abstract class vs interface, along with real-life examples. We will also discuss when we should use interfaces and abstract classes.<\/p>\n<p>In our last tutorial, we studied about <a href=\"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/\"><em><strong>abstract class in Java<\/strong><\/em><\/a> and also discussed the interfaces in Java in our previous articles. In this article, we are going to discuss the differences between Abstract Class vs Interface in Java.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77328\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg\" alt=\"difference between Abstract Class vs Interface in Java\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<h3>Abstract Class In Java<\/h3>\n<p>An <strong>Abstract<\/strong> class is a class whose objects can\u2019t be created. It is a kind of guideline or a template for other classes. An abstract class should contain at least one abstract method (method without any implementation or method body).<\/p>\n<ul>\n<li>The abstract class is declared with the help of an <strong>abstract<\/strong> keyword.<\/li>\n<li>An abstract class can be considered as an incomplete class that does not represent complete behavior.<\/li>\n<li>The abstract class can have abstract methods (methods without body) as well as concrete methods (methods with the body).<\/li>\n<li>We can not create objects or instances from the abstract classes, but they can be subclassed.<\/li>\n<\/ul>\n<p><strong>Syntax of writing Abstract classes:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">abstract class TestAbstractClass\n{\n  public abstract void abstractMethod();\n  public void normalMethod()\n  {\n    \/\/method body\n  }\n}<\/pre>\n<h4>Reasons For Using Abstract Class in Java<\/h4>\n<ul>\n<li>An abstract class provides a guideline or template for other future specific classes.<\/li>\n<li>An Abstract class gives a default functionality of Inheritance.<\/li>\n<li>The abstract class helps in achieving code reusability.<\/li>\n<li>The abstract class also allows us to define a common interface for its subclasses.<\/li>\n<\/ul>\n<p><em><strong>Get to know more about <a href=\"https:\/\/techvidvan.com\/tutorials\/java-inheritance\/\">Java Inheritance<\/a> in detail with Techvidvan.<\/strong><\/em><\/p>\n<h4>Abstract Methods in Java<\/h4>\n<ul>\n<li>Abstract methods are methods with no implementation. They do not contain any method statement.<\/li>\n<li>The child classes of this abstract class must provide the implementation of these inherited abstract methods.<\/li>\n<li>An abstract method is declared with an abstract keyword.<\/li>\n<li>The declaration of an abstract method must end with a semicolon <strong>;<\/strong><\/li>\n<\/ul>\n<p><em><strong>Check out the different <a href=\"https:\/\/techvidvan.com\/tutorials\/java-methods\/\">Java Methods<\/a> you didn&#8217;t know about.<\/strong><\/em><\/p>\n<p><strong>Syntax of declaring abstract methods:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">access-specifier abstract return-type method-name();<\/pre>\n<p><strong>Example of Abstract class:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstractclass;\n\/\/parent class\nabstract class Animal\n{\n  \/\/concrete method\n  public void show1()\n  {\n    System.out.println(\"Concrete method of parent class Class\");\n  }\n  \/\/abstract method\n  abstract public void show2();\n  }\n\/\/child class\nClass Dog extends Animal\n{\n  \/\/ Must Override this method while extending the parent class\n  public void show2()\n  {\n    System.out.println(\"Overriding abstract method of parent class\");\n  }\n\n  \/\/Overriding concrete method is not compulsory\n  public void show1()\n  {\n    System.out.println(\"Overriding concrete method of parent class\");\n  }\n}\npublic class AbstractClassDemo\n{\n  public static void main(String[] args)\n  {\n    Dog obj = new Animal();\n    obj.show2();\n    obj.show1();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Overriding abstract method of parent class<br \/>\nOverriding concrete method of parent class<\/div>\n<h4>Rules to be followed for Abstract Class<\/h4>\n<ul>\n<li>The abstract class cannot be instantiated or we can\u2019t create objects from abstract classes.<\/li>\n<li>The child class which extends the abstract class should implement all the abstract methods of the parent class otherwise, the child class should also be declared as an abstract class.<\/li>\n<\/ul>\n<h3>Interfaces in Java<\/h3>\n<p>An <strong>interface<\/strong> is another building block of Java which 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 declared as abstract, otherwise, all the methods of the interface need to be defined in the class.<\/p>\n<p><em><strong>Explore our article on <a href=\"https:\/\/techvidvan.com\/tutorials\/java-interface\/\">Interface in Java<\/a> to learn in detail.<\/strong><\/em><\/p>\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<h4>Reasons For Using Interfaces in Java<\/h4>\n<ul>\n<li>It allows us to achieve a complete abstraction.<\/li>\n<li>Interfaces are mainly designed to support dynamic method resolution at run time.<\/li>\n<li>Interfaces allow us to achieve loose coupling.<\/li>\n<li>It also helps us to separate the definition of a method from the inheritance hierarchy.<\/li>\n<\/ul>\n<h4>Implementing Interfaces<\/h4>\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 in <a href=\"https:\/\/www.oracle.com\/java\/technologies\/javase-downloads.html\">Java<\/a>, a class uses the <strong>implements<\/strong> keyword. The <strong>implements<\/strong> 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 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\nclass InterfaceDemo\n{\n  public static void main(String[] args)\n  {\n    Rectangle rectangle = new Rectangle(); \/\/ Create a Rectangle object\n\n    \/\/calling methods of class Rectangle\n    rectangle.getName();\n    rectangle.getNumberOfSides();\n    rectangle.getArea();\n    rectangle.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<\/div>\n<h4>Rules to be followed for Interface<\/h4>\n<ul>\n<li>The class that implements the Interface should implement all the methods defined in the Interface.<\/li>\n<li>An Interface can also contain final variables.<\/li>\n<\/ul>\n<h3>Abstract Class vs Interface in Java<\/h3>\n<p>We will compare Abstract Class vs Interface on the basis of following parameters:<\/p>\n<table class=\"tv-table-center\">\n<tbody>\n<tr>\n<td><b>S.No<\/b><\/td>\n<td><b>Parameter<\/b><\/td>\n<td><b>Abstract Class<\/b><\/td>\n<td><b>Interfaces<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">1.<\/span><\/td>\n<td><strong>Keyword Used<\/strong><\/td>\n<td><span style=\"font-weight: 400\">An<\/span><b> abstract<\/b><span style=\"font-weight: 400\"> keyword is used to create an abstract class.<\/span><\/td>\n<td><span style=\"font-weight: 400\">An<\/span><b> interface<\/b><span style=\"font-weight: 400\"> keyword is used to create an interface.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">2.<\/span><\/td>\n<td><strong>Type of variables<\/strong><\/td>\n<td><span style=\"font-weight: 400\">Abstract class in Java can have both final, non-final, static and non-static variables.<\/span><\/td>\n<td><span style=\"font-weight: 400\">An interface can only have final and static variables that are declared by default.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">3.<\/span><\/td>\n<td><strong>final variables<\/strong><\/td>\n<td><span style=\"font-weight: 400\">An abstract class may or may not have variables declared as final\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400\">In interfaces, variables are by default declared as final.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">4.<\/span><\/td>\n<td><strong>Access Modifiers<\/strong><\/td>\n<td><span style=\"font-weight: 400\">Abstract classes can have all access modifiers: public, protected, private and default.<\/span><\/td>\n<td><span style=\"font-weight: 400\">No other access modifiers are allowed except the public access modifier.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">5.<\/span><\/td>\n<td><strong>Type of Methods<\/strong><\/td>\n<td><span style=\"font-weight: 400\">An abstract class can have both abstract and non-abstract or concrete methods.<\/span><\/td>\n<td><span style=\"font-weight: 400\">An interface can only have abstract methods. From version 8 of Java, the interface supports static and non-static methods too.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">6.<\/span><\/td>\n<td><strong>Constructors<\/strong><\/td>\n<td><span style=\"font-weight: 400\">An abstract class can have constructors<\/span><\/td>\n<td><span style=\"font-weight: 400\">An interface can not have constructors<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">7.<\/span><\/td>\n<td><strong>Multiple Inheritance<\/strong><\/td>\n<td><span style=\"font-weight: 400\">Abstract classes do not support Multiple Inheritance. <\/span><span style=\"font-weight: 400\">A class can extend only a single abstract class but can implement multiple Java interfaces.<\/span><\/td>\n<td><span style=\"font-weight: 400\">Interfaces support Multiple Inheritance.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">8.<\/span><\/td>\n<td><strong>Implementation<\/strong><\/td>\n<td><span style=\"font-weight: 400\">We can extend an abstract class using<\/span> <span style=\"font-weight: 400\">the<\/span><b> extends<\/b><span style=\"font-weight: 400\"> keyword.<\/span><\/td>\n<td><span style=\"font-weight: 400\">We can implement an interface using<\/span> <span style=\"font-weight: 400\">the<\/span><b> implements <\/b><span style=\"font-weight: 400\">keyword.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">9.<\/span><\/td>\n<td><strong>Speed<\/strong><\/td>\n<td><span style=\"font-weight: 400\">Fast<\/span><\/td>\n<td><span style=\"font-weight: 400\">Slow as it requires extra indirection.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">10.<\/span><\/td>\n<td><strong>When to use<\/strong><\/td>\n<td><span style=\"font-weight: 400\">To avoid independence<\/span><\/td>\n<td><span style=\"font-weight: 400\">For Future enhancement<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>When to use Abstract Class?<\/h3>\n<p>Consider using abstract classes in the following cases:<\/p>\n<ul>\n<li>If you have some related classes that need to share the same lines of code, then we put these classes in abstract classes.<\/li>\n<li>If there is a requirement of using <em><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/access-modifiers-in-java\/\">access modifiers<\/a><\/strong><\/em> other than public such as protected and private for methods or fields.<\/li>\n<li>When there is a need for defining a state of an object because we need to define a non-static or non-final field.<\/li>\n<\/ul>\n<h3>When to use Interface?<\/h3>\n<p>Consider using an interface in the following cases:<\/p>\n<ul>\n<li>When you want to achieve 100% abstraction.<\/li>\n<li>If you want to achieve multiple inheritance, that is, implementing more than one interface.<\/li>\n<li>When you want to specify the behavior of a particular data type irrespective of who implements its behavior.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Abstract class and interfaces are very important aspects of OOPs in Java. They help us to achieve Abstraction in Java. In this article of Java, we learned the difference between Abstract class vs Interface on the basis of various parameters, with their syntax and implementation.<\/p>\n<p>We also discussed when and where to use the abstract classes and Interface in Java. This article will surely guide you to the right path in Java.<\/p>\n<p>Thank you for reading our article. If you have any queries related to Abstract Class vs Interface in Java, do let us know by dropping a comment below.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Java, the Abstract classes and interfaces are fundamental building blocks as they both are used to implement one of the essential concepts of Object-Oriented Programming that is, Abstraction. Though both of them are&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77328,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[1971,1972,1973,1974,1975,1966,1900,1976,1977],"class_list":["post-77111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-abstract-class-vs-interface","tag-abstract-class-vs-interface-in-java","tag-comparing-java-abstract-class-and-interface","tag-difference-between-abstract-class-and-interface","tag-interface-and-abstract-class","tag-java-abstract-class","tag-java-interface","tag-when-to-use-abstract-class","tag-when-to-use-interface"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Abstract Class vs Interface - Wipe Out all your Doubts! - TechVidvan<\/title>\n<meta name=\"description\" content=\"Get to know the difference between Abstract class vs Interface on the basis of various parameters, with syntax, implementation &amp; know when &amp; where to use them.\" \/>\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\/abstract-class-vs-interface\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Abstract Class vs Interface - Wipe Out all your Doubts! - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Get to know the difference between Abstract class vs Interface on the basis of various parameters, with syntax, implementation &amp; know when &amp; where to use them.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-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-03-07T05:27:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.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=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Abstract Class vs Interface - Wipe Out all your Doubts! - TechVidvan","description":"Get to know the difference between Abstract class vs Interface on the basis of various parameters, with syntax, implementation & know when & where to use them.","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\/abstract-class-vs-interface\/","og_locale":"en_US","og_type":"article","og_title":"Abstract Class vs Interface - Wipe Out all your Doubts! - TechVidvan","og_description":"Get to know the difference between Abstract class vs Interface on the basis of various parameters, with syntax, implementation & know when & where to use them.","og_url":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-03-07T05:27:26+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.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":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Abstract Class vs Interface &#8211; Wipe Out all your Doubts!","datePublished":"2020-03-07T05:27:26+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/"},"wordCount":1216,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg","keywords":["Abstract Class vs Interface","Abstract Class vs Interface in Java","Comparing Java Abstract Class and Interface","Difference between Abstract Class and Interface","Interface and Abstract class","Java Abstract Class","Java Interface","When to use Abstract Class","When to use Interface"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/","url":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/","name":"Abstract Class vs Interface - Wipe Out all your Doubts! - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg","datePublished":"2020-03-07T05:27:26+00:00","description":"Get to know the difference between Abstract class vs Interface on the basis of various parameters, with syntax, implementation & know when & where to use them.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/abstract-class-vs-interface-in-java-1.jpg","width":802,"height":420,"caption":"difference between Abstract Class vs Interface in Java"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/abstract-class-vs-interface\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Abstract Class vs Interface &#8211; Wipe Out all your Doubts!"}]},{"@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\/77111","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=77111"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77111\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77328"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}