{"id":77084,"date":"2020-03-06T13:56:29","date_gmt":"2020-03-06T08:26:29","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=77084"},"modified":"2020-03-06T13:56:29","modified_gmt":"2020-03-06T08:26:29","slug":"java-abstract-class","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/","title":{"rendered":"Java Abstract Class &#8211; Master the Concept with its Rules &amp; Coding Examples"},"content":{"rendered":"<p>We know that abstract class is the class that does not implement anything but is used as a template or a plan for other classes. Abstract classes are the most basic requirement to achieve Abstraction in Java.<\/p>\n<p>In our previous article on Java Abstraction, we have already taken a brief look at Abstract Class in Java. Continuing the chain in this article, we are going to learn the concept of abstract classes in Java in detail with the help of coding examples.<\/p>\n<p><em><strong>But before that, it is recommended for you to take a quick revision on <a href=\"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/\">Java Abstraction<\/a> to clear your basics with Techvidvan.<\/strong><\/em><\/p>\n<h3>Java Abstract Class<\/h3>\n<p>An Abstract class is a class that represents a concept and whose objects can\u2019t be created. A class that contains at least one abstract method (method without any implementation or method body) is called an abstract class.<\/p>\n<p>An abstract class is declared with the help of an abstract keyword. There is always a default constructor in an abstract class, it can also have a parameterized constructor.<\/p>\n<p><em><strong>Note:<\/strong> Using an abstract class, we can achieve 0 to 100% abstraction.<\/em><\/p>\n<h3>Declaring a Java Abstract Class<\/h3>\n<p>To declare an abstract class in Java we use the keyword abstract. The syntax is given below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">abstract class ClassName\n{\n  \/\/class body\n}<\/pre>\n<h3>Inheritance of Java Abstract Class<\/h3>\n<p>We can not create objects or instances from the abstract classes, but they can be subclassed. That is, to access the methods inside the abstract classes we have to inherit them. We will discuss the reason behind this concept in the later section of this article.<\/p>\n<p><em><strong>Revise the full concept of <a href=\"https:\/\/techvidvan.com\/tutorials\/java-inheritance\/\">Java Inheritance<\/a> in detail.<\/strong><\/em><\/p>\n<p><strong>Code to illustrate the above concept:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/abstract parent class\nabstract class Person\n{\n  public void displayInfo()\n  {\n    System.out.println(\"I am a person.\");\n  }\n}\nInheritance of abstract class\nclass Student extends Person\n{\n\n}\nclass AbstractClassDemo\n{\n  public static void main(String[] args)\n  {\n    \/\/Creating object of the child class\n    Student obj1 = new Student();\n\n    Accessing member of the abstract class\n    obj1.displayInfo();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">I am a person<\/div>\n<p>In the above example, we have created an abstract class Person. We cannot create objects of this abstract class Person and also cannot access the displayInfo() directly.<\/p>\n<p>To access the displayInfo() method of Person, we have extended a subclass Student from the Person. Then we created the object obj1 of this subclass and used this object to access the method displayInfo().<\/p>\n<h3>Overriding Abstract Classes in Java<\/h3>\n<p>In Java, it is compulsory to override abstract methods of the parent class in its child class because the derived class extends the abstract methods of the base class.<\/p>\n<p>If we do not override the abstract methods in the subclasses then there will be a compilation error. Therefore, it is necessary for a subclass to override the abstract methods of its base class.<\/p>\n<p><em><strong>Hold On! It&#8217;s the right t<\/strong><\/em><em><strong>ime to get familiar with the concept of <a href=\"https:\/\/techvidvan.com\/tutorials\/java-method-overriding\/\">Method Overriding in Java.\u00a0<\/a><\/strong><\/em><\/p>\n<p><em><strong>Note:<\/strong> If the subclass is also declared as abstract then it is not necessary to override the abstract methods.<\/em><\/p>\n<p><strong>Code to illustrate the above concept:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstractclass;\nabstract class Parent\n{\n  \/\/concrete method\n  public void display1()\n  {\n    System.out.println(\"Concrete method of parent class\");\n  }\n  \/\/abstract method\n  abstract public void display2();\n}\nclass Child extends Parent\n{\n  \/\/ Must Override this method while extending Parent class\n  public void display2()\n  {\n    System.out.println(\"Overriding abstract method\");\n  }\n\n  \/\/Overriding concrete method is not compulsory\n  public void display1()\n  {\n    System.out.println(\"Overriding concrete method\");\n  }\n}\npublic class AbstractClassDemo\n{\n  public static void main(String[] args)\n  {\n    Child obj = new Child();\n    obj.display2();\n    obj.display1();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Overriding abstract method<br \/>\nOverriding concrete method<\/div>\n<h3>Why do we need Abstract Classes in Java?<\/h3>\n<p>You might be thinking what is the need for abstract classes if there is no implementation in them and also we can\u2019t create an object from them.<\/p>\n<p>To answer this question let\u2019s take a situation where we want to create a class that just declares the structure or general form of a particular concept without providing a complete implementation of every method.<\/p>\n<p>And, we want that this generalized form is shared by all of its child classes, and all the implementation details will be filled by these subclasses.<\/p>\n<p>Let\u2019s take the example of a banking application or software. Suppose we have a class <strong>BankAccount<\/strong> that has a method <strong>deposit()<\/strong> and <strong>withdraw()<\/strong> and the subclasses of it like <strong>SavingsAccount, CurrentAccount, FixedDepositAccount, etc.<\/strong><\/p>\n<p>Since the process of deposit and withdrawal differs from one account to another, there is no point to implement these two methods in the parent class <strong>BankAccount.<\/strong> This is because every child class must override these methods and provide an implementation of them.<\/p>\n<p>Thus we can declare these methods as abstract in the parent class. That is, we will not provide any implementation of these abstract methods. Making this method abstract will enforce all the subclasses to implement these abstract methods otherwise, you will get a compilation error.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/example-of-abstract-class-in-java.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77274\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/example-of-abstract-class-in-java.jpg\" alt=\"java abstract class example\" width=\"568\" height=\"440\" \/><\/a><\/p>\n<h3>Abstract Methods in Java<\/h3>\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 <strong>abstract<\/strong> keyword.<\/li>\n<li>The declaration of an abstract method must end with a semicolon<strong> ;<\/strong><\/li>\n<\/ul>\n<p><em><strong>Get to know more about <a href=\"https:\/\/techvidvan.com\/tutorials\/java-methods\/\">Java Methods<\/a> in detail with Techvidvan.<\/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();\n<\/pre>\n<p><strong>Example of Abstract class and Abstract methods:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstractclass;\n\n\/\/abstract parent class\nabstract class BankAccount\n{\n  \/\/abstract methods\n  public abstract void deposit();\n  public abstract void withdraw();\n\n}\n\/\/SavingsAccount class extends BankAccount class\nclass SavingsAccount extends BankAccount\n{\n  public void deposit()\n  {\n    System.out.println(\"This is the concrete deposit method of SavingsAccount\");\n  }\n  public void withdraw()\n  {\n    System.out.println(\"This is the concrete withdraw method of SavingsAccount\\n\");\n  }\n}\n\/\/CurrentAccount class extends BankAccount class\nclass CurrentAccount extends BankAccount\n{\n  public void deposit()\n  {\n    System.out.println(\"This is the concrete deposit method of CurrentAccount\");\n  }\n  public void withdraw()\n  {\n    System.out.println(\"This is the concrete withdraw method of CurrentAccount\\n\");\n  }\n}\n\/\/FixedDepositAccount class extends BankAccount class\nclass FixedDepositAccount extends BankAccount\n{\n  public void deposit()\n  {\n    System.out.println(\"This is the concrete deposit method of FixedDepositAccount\");\n  }\n  public void withdraw()\n  {\n    System.out.println(\"This is the concrete withdraw method of FixedDepositAccount\");\n  }\n}\npublic class AbstractClassDemo\n{\n  public static void main(String args[])\n  {\n    BankAccount obj = new SavingsAccount();\n    obj.deposit();\n    obj.withdraw();\n\n    BankAccount obj1 = new CurrentAccount();\n    obj1.deposit();\n    obj1.withdraw();\n\n    BankAccount obj2 = new FixedDepositAccount();\n    obj2.deposit();\n    obj2.withdraw();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">This is the concrete deposit method of SavingsAccount<br \/>\nThis is the concrete withdraw method of SavingsAccount<br \/>\nThis is the concrete deposit method of CurrentAccount<br \/>\nThis is the concrete withdraw method of CurrentAccount<br \/>\nThis is the concrete deposit method of FixedDepositAccount<br \/>\nThis is the concrete withdraw method of FixedDepositAccount<\/div>\n<h3>Why can\u2019t we create an Object of an Abstract Class?<\/h3>\n<p>We can\u2019t instantiate an abstract class because these classes are incomplete classes, with no implementation. Abstract classes have abstract methods that have no method body.<\/p>\n<p>Suppose, if Java allows you to create an object of this class and use this object if someone calls the abstract method then what would happen? There would not be any actual implementation of the invoked method!<\/p>\n<p>Also, an abstract class is like a general structure or a template that has to be extended by the subclasses for the implementation.<\/p>\n<p><strong>Code to illustrate that object creation of an abstract class is not valid:<\/strong><\/p>\n<p>As discussed above, we cannot instantiate an abstract class. This program throws a compilation error.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstractclass;\nabstract class AbstractClass\n{\n  \/\/Abstract method\n  abstract public void display();\n}\nclass MyClass extends AbstractionDemo\n{\n  public void display()\n  {\n    System.out.print(\"Abstract method\");\n  }\n}\npublic class AbstractClassDemo\n{\n  public static void main(String args[])\n  {\n    \/\/error: You can't create object of an abstract class\n    AbstractClass obj = new AbstractClass();\n    obj.display();\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Exception in thread &#8220;main&#8221; java.lang.Error: Unresolved compilation problem:<br \/>\nCannot instantiate the type AbstractClass<\/div>\n<h3>Accessing Constructors of Abstract Class<\/h3>\n<p>As the constructors of non-abstract classes can be accessed, we can also access the constructor of an abstract class. We access the constructor from the subclass with the help of the <strong>super<\/strong> keyword. For example,<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/parent class\nabstract class Parent\n{\n  \/\/constructor of the abstract class\n  Parentl()\n  {\n    \u2026.\n  }\n}\n\/\/child class\nclass Child extends Parent\n{\n  \/\/constructor of the child class\n  Child()\n  {\n    \/\/Accessing the constructor of the abstract class using the super keyword\n    super();\n    \u2026.\n  }\n}<\/pre>\n<p>To access the constructor of the parent class, we have used the super() inside the constructor of the Child. Note that the super statement should always be the first statement of the constructor of the subclass.<\/p>\n<h3>Rules for using Abstract Class in Java<\/h3>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/rules-for-abstract-class-in-java-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77337\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/rules-for-abstract-class-in-java-1.jpg\" alt=\"Java Abstract Class Rules\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<p>There are some rules that you should remember while working the abstract classes.<\/p>\n<ol>\n<li>We can declare an abstract class using the abstract keyword.<\/li>\n<li>It may have abstract as well as concrete (non-abstract) methods.<\/li>\n<li>An abstract class can have static methods.<\/li>\n<li>An abstract class can also have constructors.<\/li>\n<li>It can have final methods. If we declare the method as final inside the abstract class then the subclass can not change the body of the method.<\/li>\n<li>We can&#8217;t instantiate or create an object of an abstract class.<\/li>\n<li>A class derived from the abstract parent class must implement each method that is declared as abstract in the parent class. Otherwise, there will be a compilation error.<\/li>\n<li>If the derived class does not implement all the abstract methods of an abstract parent class, then the derived class must also declare itself as abstract.<\/li>\n<\/ol>\n<h3>Using the final keyword in an Abstract Class<\/h3>\n<p>We can use the final keyword for variables, methods, and classes. The idea of using the final keyword is the same that is to provide security to the data, but its meaning changes from context to context.<\/p>\n<ul>\n<li>When a final keyword is used with class, then the class can not be extended.<\/li>\n<li>When we declare a variable as final, then it becomes a constant and its value can not be changed.<\/li>\n<li>A method declared as final can not be overridden in the <a href=\"https:\/\/www.ibm.com\/support\/knowledgecenter\/en\/SS6SG3_4.2.0\/com.ibm.entcobol.doc_4.2\/PGandLR\/tasks\/tpoot30.htm\">subclasses.<\/a><\/li>\n<\/ul>\n<p><em><strong>Note:<\/strong> An Abstract class may have final methods but an abstract class cannot be declared as final, otherwise we will not be able to extend it. And without extending an abstract class there is no use of it.!!<\/em><\/p>\n<p><strong>Code to illustrate the final keyword inside an abstract class:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstractclass;\n\n\/\/abstract parent class\nabstract class Parent\n{\n  final int number = 10;\n  public void display1() \/\/if we declare it as final that it can not be overriden in the Child class\n  {\n    System.out.println(\"This is a non-abstract display method of the Parent Class\");\n  }\n  abstract public void display2();\n}\n\/\/concrete child class\nclass Child extends Parent\n{\n  @Override\n  public void display1()\n  {\n    System.out.println(\"This is a non-abstract display method of the Child Class\");\n  }\n  public void display2()\n  {\n    System.out.println(\"This is the implementation of an abstract display method of the Parent Class\");\n  }\n}\npublic class AbstractClassDemo\n{\n  public static void main(String args[])\n  {\n    Parent obj = new Child();\n    obj.display1();\n    obj.display2();\n\n    \/\/Changing the value of the final variable will produce an error\n    obj.number=15;\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Exception in thread &#8220;main&#8221; java.lang.Error: Unresolved compilation problem:<br \/>\nThe final field Parent.number cannot be assigned at project1\/com.techvidvan.abstractclass.AbstractClassDemo.main(AbstractClassDemo.java:34)<\/div>\n<p><strong>To remove the error:<\/strong><\/p>\n<p><strong>Comment the line:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">obj.number=15;<\/pre>\n<p>After commenting on the above line, the <strong>output<\/strong> will be:<\/p>\n<div class=\"code-output\">This is a non-abstract display method of the Child Class<br \/>\nThis is the implementation of an abstract display method of the Parent Class<\/div>\n<h3>Difference between Abstract Class and Concrete Class<\/h3>\n<p>A concrete class is a non-abstract class that has an implementation of each method. That is, there are no abstract methods in the concrete class. An abstract class is useless until another class inherits it.<\/p>\n<p>Let\u2019s see the differences between concrete classes in an abstract class.<\/p>\n<ol>\n<li>If we declare any method as abstract in a class, then we also have to declare the class as abstract. An abstract class can also have non-abstract methods. On the other hand, a concrete class cannot have any abstract method. It has only non-abstract methods in it.<\/li>\n<li>To declare a class as abstract, we use the keyword abstract, while for declaring a concrete class we don\u2019t use any keyword.<\/li>\n<li>We can create objects of concrete class but we can never instantiate an abstract class.<\/li>\n<li>To make use of an abstract class, we need to extend or inherit it, but it is not necessary to extend a concrete class to make it useful.<\/li>\n<li>We cannot declare an abstract class as final, but we can create a concrete class with the final keyword.<\/li>\n<\/ol>\n<h3>Summary<\/h3>\n<p>Abstract classes are declared with the abstract keywords and are used to achieve Abstraction in Java. Some important rules are to be kept in mind while working with an Abstract Class in Java.<\/p>\n<p>Coming to the end of this article, we have learned the basic concept of Java Abstract Class along with its need, inheritance, methods, and rules of Abstract Class. We also explored the difference between Abstract Class and Concrete Class.<\/p>\n<p>This article will surely help you in understanding the concept of Abstract Classes in Java along with their implementation and examples.<\/p>\n<p>Thank you for reading our article. Do share your feedback through the Comment Section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We know that abstract class is the class that does not implement anything but is used as a template or a plan for other classes. Abstract classes are the most basic requirement to achieve&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77337,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[1962,1963,1964,1884,1965,1966,1967,1968,1969,1970],"class_list":["post-77084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-abstract-class-declaration-in-java","tag-abstract-class-in-java","tag-abstract-class-vs-concrete-class","tag-abstraction-in-java","tag-abstraction-in-java-with-example","tag-java-abstract-class","tag-java-abstract-class-inheritance","tag-java-abstract-class-need","tag-java-abstract-class-rules","tag-java-abstract-methods"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java Abstract Class - Master the Concept with its Rules &amp; Coding Examples - TechVidvan<\/title>\n<meta name=\"description\" content=\"Learn about Java Abstract Class along with its need, inheritance, methods, rules of Abstract Class &amp; explore the difference b\/w Abstract and Concrete Class.\" \/>\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-abstract-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Abstract Class - Master the Concept with its Rules &amp; Coding Examples - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Learn about Java Abstract Class along with its need, inheritance, methods, rules of Abstract Class &amp; explore the difference b\/w Abstract and Concrete Class.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/\" \/>\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-06T08:26:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-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=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Abstract Class - Master the Concept with its Rules &amp; Coding Examples - TechVidvan","description":"Learn about Java Abstract Class along with its need, inheritance, methods, rules of Abstract Class & explore the difference b\/w Abstract and Concrete Class.","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-abstract-class\/","og_locale":"en_US","og_type":"article","og_title":"Java Abstract Class - Master the Concept with its Rules &amp; Coding Examples - TechVidvan","og_description":"Learn about Java Abstract Class along with its need, inheritance, methods, rules of Abstract Class & explore the difference b\/w Abstract and Concrete Class.","og_url":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-03-06T08:26:29+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-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":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Java Abstract Class &#8211; Master the Concept with its Rules &amp; Coding Examples","datePublished":"2020-03-06T08:26:29+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/"},"wordCount":1682,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-in-java-1.jpg","keywords":["Abstract Class Declaration in Java","Abstract Class in Java","Abstract Class vs Concrete Class","Abstraction in Java","abstraction in Java with example","Java Abstract Class","Java Abstract Class Inheritance","Java Abstract Class Need","Java Abstract Class Rules","Java Abstract Methods"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/","url":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/","name":"Java Abstract Class - Master the Concept with its Rules &amp; Coding Examples - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-in-java-1.jpg","datePublished":"2020-03-06T08:26:29+00:00","description":"Learn about Java Abstract Class along with its need, inheritance, methods, rules of Abstract Class & explore the difference b\/w Abstract and Concrete Class.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-in-java-1.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/rules-for-abstract-class-in-java-1.jpg","width":802,"height":420,"caption":"Java Abstract Class Rules"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/java-abstract-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Java Abstract Class &#8211; Master the Concept with its Rules &amp; Coding Examples"}]},{"@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\/77084","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=77084"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/77084\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77337"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=77084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=77084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=77084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}