{"id":7619,"date":"2023-02-16T12:52:33","date_gmt":"2023-02-16T07:22:33","guid":{"rendered":"https:\/\/innovationm.co\/?p=7619"},"modified":"2023-02-16T12:52:33","modified_gmt":"2023-02-16T07:22:33","slug":"abstract-class-and-interface-in-java","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/","title":{"rendered":"Abstract Class And Interface In Java"},"content":{"rendered":"<p>Abstraction is a process of hiding the internal details of an application from the world and showing only functionality to the user.<\/p>\n<p>Example &#8211; A man driving a car. The man only knows that applying brakes will stop the car, but he does not know about the inner mechanism of the car or the implementation of brakes that how it is working in the car. This is called abstraction.<\/p>\n<p>In Java, abstraction is achieved by interfaces and abstract classes. We can achieve abstraction using interfaces and using abstract classes. With abstract classes, we can achieve abstraction 0-100% and by interfaces, we can achieve abstraction 100%.<\/p>\n<p><strong>Abstract Classes-<\/strong><\/p>\n<p>Abstract keyword is used to declare the abstract class in Java.\u00a0 It can have both abstract method and non-abstract methods (concrete method) also.<\/p>\n<p>The implementation of the abstract method is provided in the subclass. It cannot be instantiated means we can not create the object of the abstract classes.<\/p>\n<ul>\n<li>A class that is declared with an abstract keyword is known as an abstract class.<\/li>\n<li>It can have both abstract and non-abstract (concrete) methods.<\/li>\n<li>It cannot be instantiated.<\/li>\n<li>It can have constructors (because we use a constructor when the variable is not final and static to initialize it) and static methods.<\/li>\n<li>It can have final methods also.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Syntax of abstract class-<\/strong><\/p>\n<p>abstract class A{}<\/p>\n<p>&nbsp;<\/p>\n<p><strong><u>Abstract Method in Java-<\/u><\/strong><\/p>\n<p>A method that is declared with an abstract keyword and does not have implementation or has its method body in a subclass is known as an abstract method.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre>abstract void printStatus();\u00a0 \/\/no method body and abstract<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example-<\/strong><\/p>\n<p>In the below example, Bike is an abstract class that contains only one method run which is an abstract method. And Its implementation is provided by the Honda class which is the subclass of the class bike because it is extending the bike class.<\/p>\n<pre><strong>abstract class Bike{\u00a0 <\/strong>\r\n\r\n<strong>\u00a0 abstract void run();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>class Honda extends Bike{\u00a0 <\/strong>\r\n\r\n<strong>void run(){<\/strong>\r\n\r\n<strong>\u00a0 System.out.println(\"running safely\");<\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>public static void main(String args[]){\u00a0 <\/strong>\r\n\r\n<strong>\u00a0Bike obj = new Honda4();\u00a0 <\/strong>\r\n\r\n<strong>\u00a0obj.run();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong><\/pre>\n<p><strong>Output-<\/strong><\/p>\n<p>running safely<\/p>\n<p>&nbsp;<\/p>\n<p><strong>An abstract class having a constructor, data member, and methods-<\/strong><\/p>\n<p>An abstract class can have a data member, abstract method, non-abstract method, constructor, and even main() method.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<pre><strong>\u00a0<\/strong><strong>abstract class Bike{\u00a0 <\/strong>\r\n\r\n<strong>\u00a0\u00a0 Bike(){<\/strong>\r\n\r\n<strong>\u00a0\u00a0\u00a0 System.out.println(\"bike is created\");<\/strong>\r\n\r\n<strong>\u00a0\u00a0\u00a0 }\u00a0 <\/strong>\r\n\r\n<strong>\u00a0\u00a0 abstract void run();\u00a0 <\/strong>\/\/abstract method\r\n\r\n<strong>\u00a0\u00a0 void changeGear(){<\/strong>\r\n\r\n<strong>\u00a0\u00a0\u00a0 System.out.println(\"gear changed\");<\/strong>\r\n\r\n<strong>\u00a0\u00a0 }\u00a0 <\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n\/\/Creating a Child class which inherits Abstract class(Bike class)\u00a0\r\n\r\n<strong>\u00a0class Honda extends Bike{\u00a0 <\/strong>\r\n\r\n<strong>\u00a0void run(){<\/strong>\r\n\r\n<strong>\u00a0\u00a0 <\/strong><strong>System.out.println(\"running safely..\");<\/strong>\r\n\r\n<strong>\u00a0 }\u00a0 <\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>\u00a0class TestAbstraction2{\u00a0 <\/strong>\r\n\r\n<strong>\u00a0public static void main(String args[]){\u00a0 <\/strong>\r\n\r\n<strong>\u00a0 Bike obj = new Honda();\u00a0 <\/strong>\r\n\r\n<strong>\u00a0 obj.run();\u00a0 <\/strong>\r\n\r\n<strong>\u00a0 obj.changeGear();\u00a0 <\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong><\/pre>\n<p><strong>Output-<\/strong><\/p>\n<p>The bike is created<\/p>\n<p>To run safely.<\/p>\n<p>Gear changed<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Interface in Java-<\/strong><\/p>\n<p>In Java, an interface is a reference type that is similar to a class. The interface specifies what methods a class should implement. A Java interface can contain static, abstract, default, and private methods since Java 8.<\/p>\n<p>Like a class, an interface can have methods and variables, but the methods declared in an interface are by default abstract (only method signature, nobody) and variables are by default public, static, and final.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>It also can not be instantiated just like the abstract class.<\/li>\n<li>All the methods are public and abstract by default in an interface without declaration.<\/li>\n<li>All the interface fields are public, static, and final by default.<\/li>\n<li>Since Java 8, we can have default methods and static methods in an interface.<\/li>\n<li>Since Java 9, we can have private methods also in an interface.<\/li>\n<li>The interface does not have a constructor but the abstract class can have one.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Use of Java interface-<\/strong><\/p>\n<ul>\n<li>The interface is used to achieve abstraction (100%).<\/li>\n<li>We can support the functionality of multiple inheritances by the interface.<\/li>\n<li>It is used to achieve loose coupling.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Declaration of an interface-<\/strong><\/p>\n<p>An interface is declared by using the interface keyword and then the name of the interface. A class that implements an interface must implement all the methods which is declared in the interface.<\/p>\n<p><strong>Syntax<\/strong>:<\/p>\n<pre>interface &lt;interface_name&gt; {\r\n\r\n\u00a0\u00a0\u00a0 \/\/ declare constant fields\r\n\r\n\u00a0\u00a0\u00a0 \/\/ declare methods that abstract\r\n\r\n\u00a0\u00a0\u00a0 \/\/ by default.\u00a0\u00a0\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example of Interface-<\/strong><\/p>\n<p>In this example, the Drawable interface has only one method and its implementation is provided by Rectangle and Circle classes. The implementation part (method body) is hidden by the user who uses the interface.<\/p>\n<pre><strong>interface Drawable{\u00a0 <\/strong>\r\n\r\n<strong>void draw();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n\/\/Implementation: by second user\u00a0\r\n\r\n<strong>class Rectangle implements Drawable{\u00a0 <\/strong>\r\n\r\n<strong>public void draw(){<\/strong>\r\n\r\n<strong>\u00a0 System.out.println(\"drawing rectangle\");<\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>class Circle implements Drawable{\u00a0 <\/strong>\r\n\r\n<strong>public void draw(){<\/strong>\r\n\r\n<strong>\u00a0 System.out.println(\"drawing circle\");<\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n\/\/Using interface: by third user\u00a0\r\n\r\n<strong>class TestInterface1{\u00a0 <\/strong>\r\n\r\n<strong>public static void main(String args[]){\u00a0 <\/strong>\r\n\r\n<strong>Drawable d=new Circle();<\/strong>\r\n\r\n<strong>d.draw();\u00a0 <\/strong>\r\n\r\n<strong>}<\/strong>\r\n\r\n<strong>}\u00a0 <\/strong><\/pre>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>Output-<\/strong><\/p>\n<p>Drawing circle<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Multiple inheritances in Java by interface-<\/strong><\/p>\n<p>If a class implements multiple interfaces, or interface extends multiple interfaces, it is known as multiple inheritances.<\/p>\n<p>A class can extend only one class but can implement the interface once or more than once.<\/p>\n<p><strong>Example-<\/strong><\/p>\n<p>In the below example, there are Printable and Showable interfaces and class A7 is implementing a Printable and Showable interface and the implementation of the methods of interfaces are provided in the class which is implementing the interfaces.<\/p>\n<pre><strong>interface Printable{\u00a0 <\/strong>\r\n\r\n<strong>void print();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>interface Showable{\u00a0 <\/strong>\r\n\r\n<strong>void show();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>class A7 implements Printable,Showable{\u00a0 <\/strong>\r\n\r\n<strong>public void print(){<\/strong>\r\n\r\n<strong>\u00a0System.out.println(\"Hello\");<\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>public void show(){<\/strong>\r\n\r\n<strong>\u00a0System.out.println(\"Welcome\");<\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>public static void main(String args[]){\u00a0 <\/strong>\r\n\r\n<strong>A7 obj = new A7();\u00a0 <\/strong>\r\n\r\n<strong>obj.print();\u00a0 <\/strong>\r\n\r\n<strong>obj.show();\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>}<\/strong>\r\n\r\n<strong>\u00a0<\/strong><\/pre>\n<p><strong>Output<\/strong><strong>&#8211;<\/strong><\/p>\n<p>Hello<\/p>\n<p>Welcome<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Java 8 Default and Static Method in Interface-<\/strong><\/p>\n<pre><strong>interface Drawable{\u00a0 <\/strong>\r\n\r\n<strong>void draw();\u00a0 <\/strong>\r\n\r\n<strong>default void msg(){<\/strong>\r\n\r\n<strong>\u00a0System.out.println(\"default method\");<\/strong>\r\n\r\n<strong>} <\/strong>\r\n\r\n<strong>static int cube(int x){ <\/strong>\r\n\r\n<strong>\u00a0 return x*x*x;<\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>class Rectangle implements Drawable{\u00a0 <\/strong>\r\n\r\n<strong>\u00a0public void draw(){<\/strong>\r\n\r\n<strong>\u00a0 System.out.println(\"drawing rectangle\");<\/strong>\r\n\r\n<strong>\u00a0}\u00a0 <\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>class TestInterfaceDefault{\u00a0 <\/strong>\r\n\r\n<strong>public static void main(String args[]){\u00a0 <\/strong>\r\n\r\n<strong>Drawable d=new Rectangle();\u00a0 <\/strong>\r\n\r\n<strong>d.draw();\u00a0 <\/strong>\r\n\r\n<strong>d.msg();\u00a0 <\/strong>\r\n\r\n<strong>System.out.println(Drawable.cube(3));\u00a0 <\/strong>\r\n\r\n<strong>}<\/strong>\r\n\r\n<strong>}\u00a0 <\/strong>\r\n\r\n<strong>Output-<\/strong><\/pre>\n<p>&nbsp;<\/p>\n<p>Drawing rectangle<\/p>\n<p>Default method<\/p>\n<p>27<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Difference between abstract class and interface-<\/strong><\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td width=\"308\"><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Abstract Class<\/strong><\/td>\n<td width=\"330\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <strong>Interface<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"308\">1. Abstract class can have abstract and non-abstract methods(concrete method).<\/td>\n<td width=\"330\">1. Interface can have only abstract methods.<\/p>\n<p>Since Java 8, it can have default and static methods also and since Java 9, it can have private methods also.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">2. It does not support multiple inheritances.<\/td>\n<td width=\"330\">2. It supports multiple inheritances.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">3. It can have final, non-final, static, and non-static variables.<\/td>\n<td width=\"330\">3. It has only static and final variables.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">4. In this abstract keyword is used to declare an abstract class.<\/td>\n<td width=\"330\">4. The interface keyword is used to declare the interface.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">5. An abstract class can extend another Java class and can implement multiple Java interfaces.<\/td>\n<td width=\"330\">5. An interface can only extend another Java interface.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">6. An abstract class can be extended using the &#8220;extends&#8221; keyword.<\/td>\n<td width=\"330\">6. For the interface we use the &#8220;implements&#8221; keyword for implementation.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">7. An abstract class can have class members like private, protected, etc.<\/td>\n<td width=\"330\">7. There is a restriction on members because members of a Java interface are public, static, and final by default.<\/td>\n<\/tr>\n<tr>\n<td width=\"308\">Example:<\/p>\n<p>public abstract class Shape{<\/p>\n<p>public abstract void draw();<\/p>\n<p>}<\/td>\n<td width=\"330\">Example:<\/p>\n<p>public interface Drawable{<\/p>\n<p>void draw();<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Abstraction is a process of hiding the internal details of an application from the world and showing only functionality to the user. Example &#8211; A man driving a car. The man only knows that applying brakes will stop the car, but he does not know about the inner mechanism of the car or the implementation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7622,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256,360,71],"tags":[831,830,722,224,833,832],"class_list":["post-7619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-application","category-javascript","category-mobile","tag-abstract-class","tag-abstract-java","tag-blog","tag-java","tag-java-blog","tag-java-interface"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Abstract Class And Interface In Java - InnovationM - Blog<\/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:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Abstract Class And Interface In Java - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"Abstraction is a process of hiding the internal details of an application from the world and showing only functionality to the user. Example &#8211; A man driving a car. The man only knows that applying brakes will stop the car, but he does not know about the inner mechanism of the car or the implementation [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-16T07:22:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1689\" \/>\n\t<meta property=\"og:image:height\" content=\"950\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Abstract Class And Interface In Java\",\"datePublished\":\"2023-02-16T07:22:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/\"},\"wordCount\":884,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Abstract-Class-And-Interface-In-Java.png\",\"keywords\":[\"abstract class\",\"Abstract java\",\"blog\",\"java\",\"java blog\",\"java interface\"],\"articleSection\":[\"Java Application\",\"JavaScript\",\"Mobile\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/\",\"name\":\"Abstract Class And Interface In Java - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Abstract-Class-And-Interface-In-Java.png\",\"datePublished\":\"2023-02-16T07:22:33+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Abstract-Class-And-Interface-In-Java.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/Abstract-Class-And-Interface-In-Java.png\",\"width\":1689,\"height\":950},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/abstract-class-and-interface-in-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Abstract Class And Interface In Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Abstract Class And Interface In Java - InnovationM - Blog","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:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Abstract Class And Interface In Java - InnovationM - Blog","og_description":"Abstraction is a process of hiding the internal details of an application from the world and showing only functionality to the user. Example &#8211; A man driving a car. The man only knows that applying brakes will stop the car, but he does not know about the inner mechanism of the car or the implementation [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/","og_site_name":"InnovationM - Blog","article_published_time":"2023-02-16T07:22:33+00:00","og_image":[{"width":1689,"height":950,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Abstract Class And Interface In Java","datePublished":"2023-02-16T07:22:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/"},"wordCount":884,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png","keywords":["abstract class","Abstract java","blog","java","java blog","java interface"],"articleSection":["Java Application","JavaScript","Mobile"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/","url":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/","name":"Abstract Class And Interface In Java - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png","datePublished":"2023-02-16T07:22:33+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2023\/02\/Abstract-Class-And-Interface-In-Java.png","width":1689,"height":950},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/abstract-class-and-interface-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Abstract Class And Interface In Java"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=7619"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7619\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/7622"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=7619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=7619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=7619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}