{"id":76975,"date":"2020-03-02T10:23:00","date_gmt":"2020-03-02T04:53:00","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=76975"},"modified":"2020-03-02T10:23:00","modified_gmt":"2020-03-02T04:53:00","slug":"abstraction-in-java","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/","title":{"rendered":"Abstraction in Java &#8211; Learn with its Types and Real-life Examples"},"content":{"rendered":"<p>The extent to which a module hides its internal data and other implementation details from the other modules is the most important factor that distinguishes a well-designed Object-Oriented module from other modules.<\/p>\n<p>A well-designed module hides all of its implementation details and cleanly separates its interface from its implementation. These modules then communicate with each other only through the interfaces. This concept is supported with the help of Abstraction in Java.<\/p>\n<p>The meaning of the word \u201cAbstraction\u201d, in general words, is the process of working with ideas rather than their implementation.<\/p>\n<p>For example, consider the example of an email, the user does not know about the complex details such as what happens just after sending an email, which protocol is used by the server to send the message.<\/p>\n<p>Therefore, we just need to mention the address of the receiver, type the content and click the send button.<\/p>\n<p>This is basically called Abstraction in which the complex details are being hidden from the users.<\/p>\n<p>Similarly, in Object-oriented programming, abstraction is a process of providing functionality to the users by hiding its implementation details from them. In other words, the user will have just the knowledge of what an entity is doing instead of its internal working.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Advantages-of-Java-Abstraction.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77133\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Advantages-of-Java-Abstraction.jpg\" alt=\"Java Abstraction Advantages\" width=\"802\" height=\"420\" \/><\/a><\/p>\n<p>Today, we will discuss the very important concept of Object-Oriented Programming, which is Abstraction.<\/p>\n<h3>Abstraction in Java<\/h3>\n<p>An Abstraction is a process of exposing all the necessary details and hiding the rest. In Java, <strong>Data Abstraction<\/strong> is defined as the process of reducing the object to its essence so that only the necessary characteristics are exposed to the users.<\/p>\n<p>Abstraction defines an object in terms of its properties (attributes), behavior (methods), and interfaces (means of communicating with other objects).<\/p>\n<h3>Real-life Example for Java Abstraction<\/h3>\n<p>If we want to process something from the real world, we have to extract the essential characteristics of that object. Consider the example, shown in the figure below.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Example-for-Java-Abstraction.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-77132\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/03\/Example-for-Java-Abstraction.jpg\" alt=\"Java Abstraction Example\" width=\"832\" height=\"554\" \/><\/a><\/p>\n<p>Here, you can see that an <strong>Owner<\/strong> is interested in details like Car description, service history, etc; <strong>Garage Personnel<\/strong> are interested in details like License, work description, bill, owner, etc; and <strong>Registration Office<\/strong> interested in details like vehicle identification number, current owner, license plate, etc.<\/p>\n<p>It means each application identifies the details that are important to it.<\/p>\n<p>Abstraction can be seen as the technique of filtering out the unnecessary details of an object so that there remain only the useful characteristics that define it. Abstraction focuses on the perceived behavior of the entity. It provides an external view of the entity.<\/p>\n<h3>How to Achieve Abstraction in Java?<\/h3>\n<p>In Java, we can achieve Data Abstraction using <strong>Abstract classes<\/strong> and <strong>interfaces<\/strong>.<br \/>\nInterfaces allow 100% abstraction (complete abstraction). Interfaces allow you to abstract the implementation completely.<\/p>\n<p>Abstract classes allow 0 to 100% abstraction (partial to complete abstraction) because abstract classes can contain concrete methods that have the implementation which results in a partial abstraction.<\/p>\n<h3>Abstract Classes in Java<\/h3>\n<ul>\n<li>An <strong>Abstract<\/strong> class is a class whose objects can\u2019t be created. An Abstract class is created through the use of the <strong>abstract<\/strong> keyword. It is used to represent a concept.<\/li>\n<li>An abstract class can have abstract methods (methods without body) as well as non-abstract methods or concrete methods (methods with the body). A non-abstract class cannot have abstract methods.<\/li>\n<li>The class has to be declared as abstract if it contains at least one abstract method.<\/li>\n<li>An abstract class does not allow you to create objects of its type. In this case, we can only use the objects of its subclass.<\/li>\n<li>Using an abstract class, we can achieve 0 to 100% abstraction.<\/li>\n<li>There is always a default constructor in an abstract class, it can also have a parameterized constructor.<\/li>\n<li>The abstract class can also contain final and static methods.<\/li>\n<\/ul>\n<p><em><strong>Get to know more about <a href=\"https:\/\/techvidvan.com\/tutorials\/java-class\/\">Classes in Java<\/a> in detail with Techvidvan.<\/strong><\/em><\/p>\n<p><strong>Syntax of declaring an abstract class:<\/strong><\/p>\n<p>To declare an abstract class we use the keyword <strong>abstract<\/strong>. The syntax is given below:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">abstract class ClassName\n{\n\/\/class body\n}<\/pre>\n<p><em><strong>Note:<\/strong> We can not instantiate abstract classes i.e., we can not create objects or instances from the abstract classes<\/em>.<\/p>\n<h3>Abstract Methods in Java<\/h3>\n<ul>\n<li>Abstract methods are methods with no implementation and without a method body. They do not contain any method statement.<\/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<li>The child classes which inherit the abstract class must provide the implementation of these inherited abstract methods.<\/li>\n<\/ul>\n<p><em><strong>For a better understanding, take a deep insight into the concept of <a href=\"https:\/\/techvidvan.com\/tutorials\/java-methods\/\">Java Methods.<\/a><\/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 and Abstract methods<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstraction;\n\/\/parent class\nabstract class BaseClass\n{\n  \/\/abstract method\n  abstract public void show1();\n\n  \/\/concrete method\n  public void show2()\n  {\n    System.out.println(\"Concrete method of parent class\");\n  }\n}\n\/\/child class\nclass ChildClass extends BaseClass\n{\n  \/\/ Must Override this method while extending the Parent class\n  public void show1()\n  {\n    System.out.println(\"Overriding the abstract method of the parent class\");\n  }\n\n  \/\/Overriding concrete method is not compulsory\n  public voidshow2()\n  {\n    System.out.println(\"Overriding concrete method of the parent class\");\n  }\n}\npublic class AbstractionDemo\n{\n  public static void main(String[] args)\n  {\n    \/* we can't create object of the parent class hence we are creating object of the child class *\/\n    ChildClass obj = new ChildClass();\n  obj.show1();\n  obj.show 2();\n  }\n}\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Overriding abstract method of the parent class<br \/>\nOverriding concrete method of the parent class<\/div>\n<h3>Why do we need Abstract Classes in Java?<\/h3>\n<p>If we can\u2019t create an object from abstract classes and neither can\u2019t use them, then what is the need for abstract classes?<\/p>\n<p>To answer this question, let\u2019s take a situation where we want to create a class that just declares the general form or structure or guidelines of a particular idea, without giving a complete implementation of every method.<\/p>\n<p>And, we want that this generalized form or structure of the class can be used by all of its child classes, and the child classes will impose these guidelines by fulfilling all the implementation details according to the need.<\/p>\n<p>There is no need for implementing the method in the parent class thus, we can declare these methods as abstract in the parent class. That is, we will not provide any method body or implementation of these abstract methods.<\/p>\n<p>Making these methods as abstract will enforce all the derived classes to implement these abstract methods otherwise, there will be a compilation error in your code.<\/p>\n<p><strong>Code to understand the concept of Abstraction in Java:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">package com.techvidvan.abstraction;\nabstract class GeometricShapes\n{\n  String nameOfShape;\n  \/\/abstract methods\n  abstract double calculateArea();\n  public abstract String toString();\n  \/\/constructor\n  public GeometricShapes(String nameOfShape)\n  {\n    System.out.println(\"Inside the Constructor of GeometricShapes class \");\n    this.nameOfShape = nameOfShape;\n  }\n  \/\/non-abstract method\n  public String getNameOfShape()\n  {\n    return nameOfShape;\n  }\n}\nclass Circle extends GeometricShapes\n{\n  double radius;\n  public Circle(String nameOfShape,double radius)\n  {\n    super(nameOfShape);\n    System.out.println(\"Inside the Constructor of Circle class \");\n    this.radius = radius;\n  }\n  \/\/implementing the methods\n  @Override\n  double calculateArea()\n  {\n    return Math.PI * Math.pow(radius, 2);\n  }\n  @Override\n  public String toString()\n  {\n    return \"Name of the shape is \" + super.nameOfShape +\n        \" and its area is: \" + calculateArea();\n  }\n}\nclass Square extends GeometricShapes\n{\n  double length;\n  public Square(String nameOfShape,double length)\n  {\n    \/\/calling Shape constructor\n    super(nameOfShape);\n    System.out.println(\"Inside the Constructor of Square class \");\n    this.length = length;\n  }\n  \/\/implementing the methods\n  @Override\n  double calculateArea()\n  {\n    return length * length;\n  }\n  @Override\n  public String toString()\n  {\n    return \"Name of the Shape is \" + super.nameOfShape +\n        \" and its area is: \" + calculateArea();\n  }\n}\npublic class AbstractionDemo\n{\n  public static void main(String[] args)\n  {\n    GeometricShapes shapeObject1 = new Circle(\"Circle\", 6.5);\n    System.out.println(shapeObject1.toString());\n\n    GeometricShapes shapeObject2 = new Square(\"Rectangle\",8);\n    System.out.println(shapeObject2.toString());\n  }\n}<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"code-output\">Inside the Constructor of GeometricShapes class<br \/>\nInside the Constructor of Circle class<br \/>\nName of the shape is Circle and its area is: 132.73228961416876<br \/>\nInside the Constructor of GeometricShapes class<br \/>\nInside the Constructor of Square class<br \/>\nName of the Shape is Rectangle and its area is: 64.0<\/div>\n<h3>Why can\u2019t we create an object of an Abstract Class?<\/h3>\n<p>You might be wondering why can\u2019t we instantiate an abstract class or create an object from it? Suppose, if Java allows you to create an object of the abstract class and use this object.<\/p>\n<p>Now, if someone calls the abstract method through the object of the abstract class then what would happen? There would not be any actual implementation of the called method.<\/p>\n<p>Also, an abstract class is like a guideline or a template that has to be extended by its child classes for the implementation.<\/p>\n<p><strong>Code to illustrate that object creation of an abstract class is invalid:<\/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.abstraction;\n\/\/Parent class\nabstract class ParentClass\n{\n  \/\/Abstract method\n  abstract public void showDetails();\n}\n\/\/Child class\nclass ChildClass extends ParentClass\n{\n  public void showDetails()\n  {\n    System.out.print(\"Overriding Abstract method of the parent class \");\n  }\n}\npublic class AbstractionDemo\n{\n  public static void main(String args[])\n  {\n    \/\/error: You can't create object of an abstract class\n    ParentClass obj = new ParentClass();\n    obj.showDetails();\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 ParentClass<\/div>\n<h3>Types of Abstraction in Java<\/h3>\n<p>Abstraction can be of two types:<\/p>\n<h4>1. Data abstraction<\/h4>\n<p>Data abstraction is the most common type of abstraction in which we create complex data types such as <a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/util\/HashMap.html\">HashMap<\/a> or HashSet, and hide its implementation details from the users and display only the meaningful operations to interact with the data type.<\/p>\n<p>The benefit of this approach solves the performance issues and improves the implementation over time. Any changes which occur while improving the performance, do not reflect on the code present on the client-side.<\/p>\n<h4>2. Control abstraction<\/h4>\n<p>Control abstraction is the process of determining all such statements which are similar and repeat over many times and expose them as a single unit of work. We normally use this type of abstraction is when we want to create a function to perform any given task.<\/p>\n<h3>Advantages of Abstraction in Java<\/h3>\n<ul>\n<li>It reduces the complexity of viewing things.<\/li>\n<li>Increases software reuse and avoids code duplication: Loosely-coupled classes often prove useful in other contexts.<\/li>\n<li>It helps to increase the security and confidentiality of an application as only necessary details are exposed to the user.<\/li>\n<li>Eases the burden of maintenance \u2013 Classes can be understood more quickly and debugged with little fear of harming other modules.<\/li>\n<\/ul>\n<h3>Data Encapsulation vs Data Abstraction in Java<\/h3>\n<ul>\n<li>Encapsulation is one step beyond abstraction.<\/li>\n<li>Data Encapsulation is hiding data or information while Abstraction is hiding the implementation details.<\/li>\n<li>Encapsulation binds the data members and methods together while data abstraction deals with showing the external details of an entity to the user and hiding the details of its implementation.<\/li>\n<li>Abstraction provides access to a specific part of data while encapsulation hides the data.<\/li>\n<\/ul>\n<h4>Things to Remember<\/h4>\n<ul>\n<li>In Java, you can not create an object from the abstract class using the new operator. If you try to instantiate an abstract class, it will give a compilation error.<\/li>\n<li>An abstract class can have a constructor.<\/li>\n<li>It can contain both abstract as well as concrete methods. An abstract method just has the declaration but not any method body.<\/li>\n<li>In Java, only classes or methods can be declared as abstract, we can not declare a variable as abstract.<\/li>\n<li>We use the keyword abstract to declare both class and method as abstract.<\/li>\n<li>If we declare any method as abstract, the class automatically needs to become an abstract class.<\/li>\n<\/ul>\n<h3>Summary<\/h3>\n<p>Through Data Abstraction we can reduce a real-world entity into its essential defining features and show only what is necessary to the users. The concept of data abstraction is totally based on abstract classes in Java.<\/p>\n<p>Here we come to the end of our Java article. Now let&#8217;s look at what all we have learned. In this article, we have discussed the importance of Abstraction in Java with real-life examples.<\/p>\n<p>We also covered the detailed description of abstract classes and abstract methods in Java with their syntax and examples. Now, you might have understood the importance of Abstraction in OOPs and also how to implement it in your codes.<\/p>\n<p>Thank you for reading our article. Do share this Java article on Social Media.<\/p>\n<p>Happy Learning \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The extent to which a module hides its internal data and other implementation details from the other modules is the most important factor that distinguishes a well-designed Object-Oriented module from other modules. A well-designed&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":77133,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[183],"tags":[1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893],"class_list":["post-76975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-abstract-classes-in-java","tag-abstract-methods-in-java","tag-abstraction-in-java","tag-data-abstraction-in-java","tag-data-abstraction-vs-encapsulation","tag-java-abstract-classes","tag-java-abstraction","tag-java-abstraction-advantages","tag-java-abstraction-example","tag-java-abstraction-types","tag-use-of-abstract-class","tag-why-java-abstraction"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Abstraction in Java - Learn with its Types and Real-life Examples - TechVidvan<\/title>\n<meta name=\"description\" content=\"Get to know the about Abstraction in Java with real-life examples along with description of abstract classes &amp; methods in Java with their syntax &amp; examples.\" \/>\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\/abstraction-in-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Abstraction in Java - Learn with its Types and Real-life Examples - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Get to know the about Abstraction in Java with real-life examples along with description of abstract classes &amp; methods in Java with their syntax &amp; examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/\" \/>\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-02T04:53:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.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":"Abstraction in Java - Learn with its Types and Real-life Examples - TechVidvan","description":"Get to know the about Abstraction in Java with real-life examples along with description of abstract classes & methods in Java with their syntax & examples.","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\/abstraction-in-java\/","og_locale":"en_US","og_type":"article","og_title":"Abstraction in Java - Learn with its Types and Real-life Examples - TechVidvan","og_description":"Get to know the about Abstraction in Java with real-life examples along with description of abstract classes & methods in Java with their syntax & examples.","og_url":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-03-02T04:53:00+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.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\/abstraction-in-java\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Abstraction in Java &#8211; Learn with its Types and Real-life Examples","datePublished":"2020-03-02T04:53:00+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/"},"wordCount":1661,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.jpg","keywords":["Abstract Classes in Java","Abstract Methods in Java","Abstraction in Java","Data Abstraction in Java","Data Abstraction Vs Encapsulation","Java Abstract Classes","Java Abstraction","Java Abstraction Advantages","Java Abstraction Example","Java Abstraction Types","Use of Abstract Class","Why Java Abstraction"],"articleSection":["Java Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/","url":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/","name":"Abstraction in Java - Learn with its Types and Real-life Examples - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.jpg","datePublished":"2020-03-02T04:53:00+00:00","description":"Get to know the about Abstraction in Java with real-life examples along with description of abstract classes & methods in Java with their syntax & examples.","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/03\/Advantages-of-Java-Abstraction.jpg","width":802,"height":420,"caption":"Java Abstraction Advantages"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/abstraction-in-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Abstraction in Java &#8211; Learn with its Types and Real-life 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\/76975","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=76975"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/76975\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/77133"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=76975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=76975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=76975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}