{"id":13633,"date":"2020-03-21T13:19:40","date_gmt":"2020-03-21T20:19:40","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=13633"},"modified":"2023-12-01T02:34:45","modified_gmt":"2023-12-01T10:34:45","slug":"java-abstract-class","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/","title":{"rendered":"Java Abstract Class"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">How to Use Java\u2019s \u201cAbstract\u201d Classes and Methods <\/h2>\n\n\n\n<p><code>Abstraction<\/code> is one of the three core principles in object-oriented programming\u2014alongside encapsulation and <a href=\"https:\/\/careerkarma.com\/blog\/java-inheritance\">inheritance<\/a>.&nbsp;<\/p>\n\n\n\n<p>Abstraction is one way to reduce the complexity of your programs and make your code easier to read. In Java, abstraction allows you to:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>show only certain details of a class and&nbsp;<\/li>\n\n\n\n<li>hide all other details of that class.&nbsp;<\/li>\n<\/ol>\n\n\n\n<p>Abstraction can be applied to both classes and methods in Java.<\/p>\n\n\n\n<p>This tutorial will discuss the basics of abstraction in Java, how to use abstract classes, and how to use abstract methods. We\u2019ll also walk through a few examples to help you better understand this important concept.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Abstraction<\/h2>\n\n\n\n<p>Object-oriented programming is a type of programming that uses objects and classes to represent data and methods. Using objects and classes can reduce repetition in code and can make programs more efficient.<\/p>\n\n\n\n<p>Java is an object-oriented programming language. As such, it includes a number of features used to work with objects and classes. Abstraction is one of those features. Abstraction allows you to show only certain information to a class in Java.<\/p>\n\n\n\n<p>There are two instances where abstraction is used in Java: in classes and in methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Abstract Classes<\/h2>\n\n\n\n<p>In Java, an abstract class is a class from which you cannot create any objects. In other words, abstract classes cannot be instantiated.<\/p>\n\n\n\n<p>To create an abstract class in Java, you can use the abstract keyword. Here\u2019s an example of an abstract class in Java: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>abstract class BankAccount {\n\t\/\/ Code here\n}<\/pre><\/div>\n\n\n\n<p>Since this is an abstract class, if we try to create an object with this class, our program will return an error.&nbsp;<\/p>\n\n\n\n<p>For example, suppose we try to create an instance of a class called BankAccount. We want to call this instance lucyAccount, and we want it to store Lucy\u2019s bank information. Lucy is one of our customers. We use the following code to try to create this instance:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>BankAccount lucyAccount = new BankAccount();<\/pre><\/div>\n\n\n\n<p>When we run this code, however, our program returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>BankAccount is abstract; cannot be instantiated<\/pre><\/div>\n\n\n\n<p>As you can see, you cannot assign abstract classes to an object.&nbsp;<\/p>\n\n\n\n<p>However, you can still create subclasses from abstract classes. In the next section, we discuss how to create subclasses from abstract classes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Abstract Class Inheritance<\/h2>\n\n\n\n<p>As we mentioned, you cannot assign objects an abstract class. So, in order to access the contents of an abstract class\u2014in other words, the attributes and methods associated with that class\u2014we have to <code>inherit<\/code> the class.<\/p>\n\n\n\n<p>Suppose we are creating a program that stores bank account information for a bank. Our program will include two classes: BankAccount and CheckingAccount. BankAccount will be a parent class that stores the attributes and methods for working with bank accounts. CheckingAccount will be a child class that inherits those methods.&nbsp;<\/p>\n\n\n\n<p>For this example, BankAccount is an abstract class. We only want to use it to create checking accounts.<\/p>\n\n\n\n<p>Here\u2019s the code we can use to work with our BankAccount and CheckingAccount classes:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>abstract class BankAccount {\n\tpublic void viewAccountNumber() {\n\t\tSystem.out.println(\"Account number: #1932042\");\n\t}\n}\nclass CheckingAccount extends BankAccount {\n}\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tCheckingAccount lucyAccount = new CheckingAccount();\n\t\tlucyAccount.viewAccountNumber();\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Account number: #1932042<\/pre><\/div>\n\n\n\n<p>In this example, we created three classes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>BankAccount<\/strong>. This is an abstract class. It contains a method called <code>viewAccountNumber()<\/code>. Because BankAccount is an abstract class, we cannot create an object of the class.&nbsp;<\/li>\n\n\n\n<li><strong>CheckingAccount<\/strong>. This is a child class. As a child class, it inherits the attributes and methods of the BankAccount class.&nbsp;<\/li>\n\n\n\n<li><strong>Main<\/strong>. This class contains the code for our main program.&nbsp;<\/li>\n<\/ol>\n\n\n\n<p>In our main program, we create an instance of the CheckingAccount class and call it lucyAccount. lucyAccount is an object. After creating the three classes in our program, we used the lucyAccount object in the method <code>viewAccountNumber()<\/code>.<\/p>\n\n\n\n<p>The following table summarizes key parts of this example:<\/p>\n\n\n\n<figure class=\"wp-block-table course-info-table\"><table><tbody><tr><td><strong>NAME<\/strong><\/td><td><strong>TYPE<\/strong><\/td><td><strong>DESCRIPTION<\/strong><\/td><\/tr><tr><td><strong>BankAccount<\/strong><\/td><td>abstract\/parent class<\/td><td>Stores the attributes and methods for working with bank accounts.<\/td><\/tr><tr><td><strong>CheckingAccount<\/strong><\/td><td>child class<\/td><td>Inherits the methods of the parent class.<\/td><\/tr><tr><td><strong>Main<\/strong><\/td><td>class<\/td><td>Contains the code for our main program.<\/td><\/tr><tr><td><strong>lucyAccount<\/strong><\/td><td>object<\/td><td>The real-world application of our program.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>If you\u2019re interested in learning more about inheritance in Java, read our complete guide <a href=\"https:\/\/careerkarma.com\/blog\/java-inheritance\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Abstract Methods<\/h2>\n\n\n\n<p>In addition to classes, methods can also be abstract.<\/p>\n\n\n\n<p>When you declare an abstract method, you use the same abstract keyword as above. You do not specify any contents, and you can only declare an abstract method within an abstract class.<\/p>\n\n\n\n<p>Here\u2019s an example of an abstract method in Java:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>abstract void checkBalance();<\/pre><\/div>\n\n\n\n<p>In this example, we created an abstract method called <code>checkBalance()<\/code>. This method has no body\u2014in other words, there is no code associated with the method.<\/p>\n\n\n\n<p>Let\u2019s return to our bank example from earlier. That program contains an abstract method: <code>lucyAccount.viewAccountNumber();<\/code>.<\/p>\n\n\n\n<p>We used this abstract method to enable our program to display a customer\u2019s bank account numbers. In the example above (from the previous section), the BankAccount parent class acts as a sort of template for child class(es).<\/p>\n\n\n\n<p>In this case, the child classes are different kinds of bank accounts. This is because our customers may have more than one kind of bank account, and we may want to perform the same function on each kind of account. The child class we created above was: CheckingAccount.&nbsp;<\/p>\n\n\n\n<p>Let\u2019s go back to our customer from the example above. Lucy has a checking account, but she may also have a savings account and a brokerage account. We want to be able to display the account numbers for each of Lucy\u2019s accounts. We can do so by creating child classes for these two additional account types. We could call them: SavingsAccount, BrokerageAccount.&nbsp;<\/p>\n\n\n\n<p>Since we created the BankAccount parent class, we can efficiently and with minimal code repetition display account numbers for all three account types.&nbsp;<\/p>\n\n\n\n<p>In the code below, we use the abstract keyword twice. First, we declare an abstract class (BankAccount). Then, we declare an abstract method that will later help us direct the program to display a customer\u2019s account number(s). That abstract method declaration is: abstract void <code>viewAccountNumber();<\/code>. Then we initialize the <code>viewAccountNumber()<\/code> method on the CheckingAccount child class. Here\u2019s the code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>abstract class BankAccount {\n\tabstract void viewAccountNumber();\n}\nclass CheckingAccount extends BankAccount {\npublic void viewAccountNumber() {\n\t\tSystem.out.println(\"Checking account number: #1932042\");\n\t}\n}\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tCheckingAccount lucyAccount = new CheckingAccount();\n\t\tlucyAccount.viewAccountNumber();\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Checking account number: #1932042<\/pre><\/div>\n\n\n\n<p>This example returns the same output as our earlier example, but there are a few code differences to note. They are:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Declaration of abstract method.<\/strong> In the example here, we declare an abstract class called BankAccount. This class contains an abstract method called <code>viewAccountNumber()<\/code>.<\/li>\n\n\n\n<li><strong>Extension of the abstract method.<\/strong> We extend the BankAccount class through the CheckingAccount class. The CheckingAccount class inherits the values stored in the BankAccount method.&nbsp;<\/li>\n<\/ol>\n\n\n\n<p>In the CheckingAccount class, we define a method\u2014called <code>viewAccountNumber()<\/code>\u2014that is only accessible to CheckingAccount objects. Then, in order to see the customer\u2019s account number, we create a CheckingAccount object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Java Abstraction Example<\/h2>\n\n\n\n<p>Now that we\u2019ve discussed both Java abstract classes and abstract methods, we can explore a full example of abstraction in Java. To do so, we will bring together everything we discussed in the bank account examples above.<\/p>\n\n\n\n<p>Suppose we are operating a bank that offers two types of bank accounts: checking accounts and savings accounts. We decide to write a program that allows bank account holders to check their account numbers.&nbsp;<\/p>\n\n\n\n<p>At our bank, if a bank account is a checking account, the account number starts with the customer\u2019s ID number and ends in 555. If the account is a savings account, the account number ends in 777.<\/p>\n\n\n\n<p>We could use the following code to create this program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>abstract class BankAccount {\n\tabstract void viewAccountNumber();\n}\nclass CheckingAccount extends BankAccount {\n\tpublic void viewAccountNumber() {\n\t\tSystem.out.println(\"Checking account number: #1932042555\");\n\t}\n}\nclass SavingsAccount extends BankAccount {\n\tpublic void viewAccountNumber() {\n\t\tSystem.out.println(\"Savings account number: #1932042777\");\n\t}\n}\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tCheckingAccount ellieCheckingAccount = new CheckingAccount();\n\t\tellieCheckingAccount.viewAccountNumber()\n\t\tSavingsAccount ellieSavingsAccount = new SavingsAccount();\n\t\tellieSavingsAccount.viewAccountNumber();\n\t}\n}<\/pre><\/div>\n\n\n\n<p>Our code returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Checking account number: #1932042555\nSavings account number: #1932042777<\/pre><\/div>\n\n\n\n<p>In this example, we created a class and called it BankAccount. This class had one abstract method, called <code>viewAccountNumber()<\/code>.<\/p>\n\n\n\n<p>Each type of account assigns account numbers differently, so we cannot implement the <code>viewAccountNumber()<\/code> method in the BankAccount class. Instead, each subclass of the BankAccount class implements the <code>viewAccountNumber()<\/code> method.<\/p>\n\n\n\n<p>In this example, the CheckingAccount class assigns account numbers as a number that starts with the customer\u2019s ID and ends with 555. The SavingsAccount class assigns account numbers as a number that starts with the customer\u2019s ID and ends with 777.<\/p>\n\n\n\n<p>In our code, we initialize an instance of the CheckingAccount class for a customer called Ellie. This instance is assigned the name ellieCheckingAccount, and we invoke the <code>viewAccountNumber()<\/code> method to view the account\u2019s number. This returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Checking account number: #1932042555<\/pre><\/div>\n\n\n\n<p>We also initialize an instance of the SavingsAccount class, called ellieSavingsAccount, and we invoke the <code>viewAccountNumber()<\/code> method to view the account\u2019s number. This returns: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Savings account number: #1932042777<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p><code>Abstraction<\/code> is an important feature of object-oriented programming. It allows you to hide certain details in a class or method and display only essential information. To create abstract classes and methods in Java, use the <code>abstract<\/code> keyword.<\/p>\n\n\n\n<p>This tutorial discussed, with examples, how abstraction works, why abstraction is useful, and how you can create abstract methods and classes in Java. Now you\u2019re ready to start working with abstract classes and methods in Java like a professional programmer!<\/p>\n","protected":false},"excerpt":{"rendered":"How to Use Java\u2019s \u201cAbstract\u201d Classes and Methods Abstraction is one of the three core principles in object-oriented programming\u2014alongside encapsulation and inheritance.&nbsp; Abstraction is one way to reduce the complexity of your programs and make your code easier to read. In Java, abstraction allows you to: show only certain details of a class and&nbsp; hide&hellip;","protected":false},"author":240,"featured_media":13587,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17289],"tags":[],"class_list":{"0":"post-13633","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-java"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Java","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Java Abstract Class: The Complete Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/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\" \/>\n<meta property=\"og:description\" content=\"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/java-abstract-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-21T20:19:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T10:34:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"659\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Java Abstract Class\",\"datePublished\":\"2020-03-21T20:19:40+00:00\",\"dateModified\":\"2023-12-01T10:34:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/\"},\"wordCount\":1449,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/nescafe-cup-near-imac-225502-1.jpg\",\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/\",\"name\":\"Java Abstract Class: The Complete Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/nescafe-cup-near-imac-225502-1.jpg\",\"datePublished\":\"2020-03-21T20:19:40+00:00\",\"dateModified\":\"2023-12-01T10:34:45+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/nescafe-cup-near-imac-225502-1.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/nescafe-cup-near-imac-225502-1.jpg\",\"width\":1020,\"height\":659},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java-abstract-class\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/java\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Java Abstract Class\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Java Abstract Class: The Complete Guide | Career Karma","description":"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.","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:\/\/careerkarma.com\/blog\/java-abstract-class\/","og_locale":"en_US","og_type":"article","og_title":"Java Abstract Class","og_description":"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.","og_url":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-03-21T20:19:40+00:00","article_modified_time":"2023-12-01T10:34:45+00:00","og_image":[{"width":1020,"height":659,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Java Abstract Class","datePublished":"2020-03-21T20:19:40+00:00","dateModified":"2023-12-01T10:34:45+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/"},"wordCount":1449,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg","articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/java-abstract-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/","url":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/","name":"Java Abstract Class: The Complete Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg","datePublished":"2020-03-21T20:19:40+00:00","dateModified":"2023-12-01T10:34:45+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Developers use the Java \u201cabstract\u201d keyword to declare abstract classes and methods. On Career Karma, learn how the \u201cabstract\u201d keyword works in Java code.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/java-abstract-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/nescafe-cup-near-imac-225502-1.jpg","width":1020,"height":659},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/java-abstract-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/careerkarma.com\/blog\/java\/"},{"@type":"ListItem","position":3,"name":"Java Abstract Class"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=13633"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/13587"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=13633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=13633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=13633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}