Title: Java Inheritance Example - Java Code Geeks
Open Graph Title: Java Inheritance Example - Java Code Geeks
Description: In this tutorial, we will discuss the inheritance in Java. In Java, classes can be derived from other classes by using the extends keyword.
Open Graph Description: In this tutorial, we will discuss the inheritance in Java. In Java, classes can be derived from other classes by using the extends keyword.
Mail addresses
support@javacodegeeks.com
Opengraph URL: https://examples.javacodegeeks.com/java-inheritance-example/
Generator: WordPress 6.9.4
Domain: examples.javacodegeeks.com
{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://examples.javacodegeeks.com/java-inheritance-example/#article","isPartOf":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/"},"author":{"name":"Sotirios-Efstathios Maneas","@id":"https://examples.javacodegeeks.com/#/schema/person/03673b064b32807176478bd144079be1"},"headline":"Java Inheritance Example","datePublished":"2014-02-13T21:30:18+00:00","dateModified":"2023-11-09T12:42:22+00:00","mainEntityOfPage":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/"},"wordCount":1120,"commentCount":2,"publisher":{"@id":"https://examples.javacodegeeks.com/#organization"},"image":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/#primaryimage"},"thumbnailUrl":"https://examples.javacodegeeks.com/wp-content/uploads/2012/12/java-logo.jpg","articleSection":["Java Basics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https://examples.javacodegeeks.com/java-inheritance-example/#respond"]}]},{"@type":"WebPage","@id":"https://examples.javacodegeeks.com/java-inheritance-example/","url":"https://examples.javacodegeeks.com/java-inheritance-example/","name":"Java Inheritance Example - Java Code Geeks","isPartOf":{"@id":"https://examples.javacodegeeks.com/#website"},"primaryImageOfPage":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/#primaryimage"},"image":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/#primaryimage"},"thumbnailUrl":"https://examples.javacodegeeks.com/wp-content/uploads/2012/12/java-logo.jpg","datePublished":"2014-02-13T21:30:18+00:00","dateModified":"2023-11-09T12:42:22+00:00","description":"In this tutorial, we will discuss the inheritance in Java. In Java, classes can be derived from other classes by using the extends keyword.","breadcrumb":{"@id":"https://examples.javacodegeeks.com/java-inheritance-example/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https://examples.javacodegeeks.com/java-inheritance-example/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https://examples.javacodegeeks.com/java-inheritance-example/#primaryimage","url":"https://examples.javacodegeeks.com/wp-content/uploads/2012/12/java-logo.jpg","contentUrl":"https://examples.javacodegeeks.com/wp-content/uploads/2012/12/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https://examples.javacodegeeks.com/java-inheritance-example/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://examples.javacodegeeks.com/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https://examples.javacodegeeks.com/category/java-development/"},{"@type":"ListItem","position":3,"name":"Java Basics","item":"https://examples.javacodegeeks.com/category/java-development/java-basics/"},{"@type":"ListItem","position":4,"name":"Java Inheritance Example"}]},{"@type":"WebSite","@id":"https://examples.javacodegeeks.com/#website","url":"https://examples.javacodegeeks.com/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https://examples.javacodegeeks.com/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://examples.javacodegeeks.com/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https://examples.javacodegeeks.com/#organization","name":"Exelixis Media P.C.","url":"https://examples.javacodegeeks.com/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https://examples.javacodegeeks.com/#/schema/logo/image/","url":"https://examples.javacodegeeks.com/wp-content/uploads/2022/06/exelixis-logo.png","contentUrl":"https://examples.javacodegeeks.com/wp-content/uploads/2022/06/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https://examples.javacodegeeks.com/#/schema/logo/image/"},"sameAs":["https://www.facebook.com/javacodegeeks","https://x.com/javacodegeeks"]},{"@type":"Person","@id":"https://examples.javacodegeeks.com/#/schema/person/03673b064b32807176478bd144079be1","name":"Sotirios-Efstathios Maneas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https://examples.javacodegeeks.com/#/schema/person/image/","url":"https://examples.javacodegeeks.com/wp-content/uploads/2013/10/Stathis-Maneas-96x96.jpg","contentUrl":"https://examples.javacodegeeks.com/wp-content/uploads/2013/10/Stathis-Maneas-96x96.jpg","caption":"Sotirios-Efstathios Maneas"},"description":"Sotirios-Efstathios (Stathis) Maneas is a PhD student at the Department of Computer Science at the University of Toronto. His main interests include distributed systems, storage systems, file systems, and operating systems.","sameAs":["https://www.cs.utoronto.ca/~smaneas/","https://www.facebook.com/stathis.maneas","https://linkedin.com/in/smaneas"],"url":"https://examples.javacodegeeks.com/author/stathis-maneas/"}]}
{"@context":"http:\/\/schema.org","@type":"BreadcrumbList","@id":"#Breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"item":{"name":"Home","@id":"https:\/\/examples.javacodegeeks.com\/"}},{"@type":"ListItem","position":2,"item":{"name":"Java Development","@id":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"}},{"@type":"ListItem","position":3,"item":{"name":"Java Basics","@id":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/java-basics\/"}}]}
{"@context":"http:\/\/schema.org","@type":"Article","dateCreated":"2014-02-13T23:30:18+02:00","datePublished":"2014-02-13T23:30:18+02:00","dateModified":"2023-11-09T14:42:22+02:00","headline":"Java Inheritance Example","name":"Java Inheritance Example","keywords":[],"url":"https:\/\/examples.javacodegeeks.com\/java-inheritance-example\/","description":"In this tutorial, we will discuss the inheritance in Java. The most fundamental element of Java is the class. A class represents an entity and also, defines and implements its functionality. In Java,","copyrightYear":"2014","articleSection":"Java Basics","articleBody":"\nIn this tutorial, we will discuss the inheritance in Java. The most fundamental element of Java is the class. A class represents an entity and also, defines and implements its functionality. In Java, classes can be derived from other classes by using the extends keyword, in order to create more complex relationships.\n\n\n\nYou can also check this tutorial in the following video:\n\n\n\nJava Inheritance Tutorial - video\n\n\n\n1. Introduction\n\n\n\nA class that is derived from another class is called subclass and inherits all fields and methods of its superclass. In Java, only single inheritance is allowed and thus, every class can have at most one direct superclass. A class can be derived from another class that is derived from another class and so on. Finally, we must mention that each class in Java is implicitly a subclass of the Object class.Suppose we have declared and implemented a class A. In order to declare a class B that is derived from A, Java offers the extends keyword that is used as shown below:\n\n\n\n\n\n\n\n\n\n1\n2\n3\n4\n5\n6\n7\n8\n\n\n\nclass A {\n \/\/Members and methods declarations.\n}\n \nclass B extends A {\n \/\/Members and methods from A are inherited.\n \/\/Members and methods declarations of B.\n}\n\n\n\n\n\n\n\n\n\n\nJava supports only public inheritance and thus, all fields and methods of the superclass are inherited and can be used by the subclass. The only exception is the private members of the superclass that cannot be accessed directly from the subclass. Also, constructors are not members, thus they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass. In order to call the constructor of the superclass Java provides the keyword super, as shown below:\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n\n\n\nclass A {\n public A() {\n System.out.println(\"New A\");\n }\n}\n \nclass B extends A {\n public B() {\n super();\n System.out.println(\"New B\");\n }\n}\n\n\n\n\n\n\n\n\n\n\nA sample example to present the inheritance in Java is shown below:\n\n\n\nAnimal.java\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n\n\n\npublic class Animal {\n public Animal() {\n System.out.println(\"A new animal has been created!\");\n }\n \n public void sleep() {\n System.out.println(\"An animal sleeps...\");\n }\n \n public void eat() {\n System.out.println(\"An animal eats...\");\n }\n}\n\n\n\n\n\n\n\n\n\n\nBird.java\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n\n\n\npublic class Bird extends Animal {\n public Bird() {\n super();\n System.out.println(\"A new bird has been created!\");\n }\n \n @Override\n public void sleep() {\n System.out.println(\"A bird sleeps...\");\n }\n \n @Override\n public void eat() {\n System.out.println(\"A bird eats...\");\n }\n}\n\n\n\n\n\n\n\n\n\n\nDog.java\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n\n\n\npublic class Dog extends Animal {\n public Dog() {\n super();\n System.out.println(\"A new dog has been created!\");\n }\n \n @Override\n public void sleep() {\n System.out.println(\"A dog sleeps...\");\n }\n \n @Override\n public void eat() {\n System.out.println(\"A dog eats...\");\n }\n}\n\n\n\n\n\n\n\n\n\n\nMainClass.java\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n\n\n\npublic class MainClass {\n public static void main(String[] args) {\n Animal animal = new Animal();\n Bird bird = new Bird();\n Dog dog = new Dog();\n \n System.out.println();\n \n animal.sleep();\n animal.eat();\n \n bird.sleep();\n bird.eat();\n \n dog.sleep();\n dog.eat();\n }\n}\n\n\n\n\n\n\n\n\n\n\nIn this example, we created three distinct classes, Animal, Dog and Bird. Both Dog and Bird classes extend the Animal class by using the java extends keyword and thus, they inherit its members and methods. Moreover, as we can see below, each class overrides the methods of Animal and thus, both the Dog and Bird classes redefine the functionality of Animal\u2019s methods.\n\n\n\nA sample execution is shown below:\n\n\n\nA new animal has been created!\nA new animal has been created!\nA new bird has been created!\nA new animal has been created!\nA new dog has been created!\n\nAn animal sleeps...\nAn animal eats...\nA bird sleeps...\nA bird eats...\nA dog sleeps...\nA dog eats...\n\n\n\n\nA nested class has access to all the private members of its enclosing class, both fields and methods. Therefore, a public or protected nested class inherited by a subclass has indirect access to all of the private members of the superclass.\n\n\n\nAs already mentioned, a subclass inherits all of the public and protected members of its superclass. If the subclass is in the same package as its superclass, it also inherits the package-private members of the superclass. The inheritance in Java provides the following features:\n\n\n\n\nYou can declare a field in the subclass with the same name as the one in the superclass thus, hiding it. This is called shadowing.\n\n\n\nYou can declare new fields in the subclass that are not in the superclass.\n\n\n\nYou can write a new instance method in the subclass that has the same signature as the one in the superclass, thus overriding it.\n\n\n\nYou can declare new methods in the subclass that are not in the superclass.\n\n\n\n\nFinal abstract classes can exist in a hierarchy of types. For more information about abstract classes and how they are used in Java, please refer to the Java abstract tutorial here.\n\n\n\n2. Inheritance and Casting\n\n\n\nIn Java, When class B extends a class A, then an instance of the B class is of type B, but also of type A. Thus, such an instance can be used in all cases where a class B or class A object is required. However, the reverse is not true! An instance of the class A is of course of type A, but it is not of type B.\n\n\n\nThus, we can use casting between the instances of classes. The cast inserts a runtime check, in order for the compiler to safely assume that the cast is used properly and is correct. If not, a runtime exception will be thrown.\n\n\n\nA simple example that demonstrates the usage of casting is shown below:\n\n\n\n\n\n\n\n\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n\n\n\nAnimal a1 = new Dog();\nAnimal a2 = new Bird();\n \na1.eat();\na2.sleep();\n \n\/\/ The following statements are incorrect.\n\/\/ Dog d = new Animal();\n\/\/ Bird b = new Animal();\n\n\n\n\n\n\n\n\n\n\nA sample execution is shown below:\n\n\n\nA dog eats...\nA bird sleeps...\n\n\n\n\n3. The instanceof operator\n\n\n\nThe instanceof operator can be used, in order to determine if an object is a valid instance of a specific type. It can be used to test if an object is an instance of a class, an instance of a subclass, or an instance of a class that implements a particular interface. A simple example is shown below:\n\n\n\n\n\n\n\n\n\n1\n2\n3\n4\n5\n6\n\n\n\nDog d = new Dog();\nif(d instanceof Animal) {\n Animal a = (Animal) d;\n a.sleep();\n}\nd.sleep();\n\n\n\n\n\n\n\n\n\n\n4. Interfaces\n\n\n\nAn interface in Java is an abstract type that is used to declare and specify a set of public methods and members. An interface can be implemented by a class. In this case, the class must provide an implementation for every method defined in the interface. A significant advantage of using interfaces is the fact that in Java, multiple interfaces can be implemented by a single class.\n\n\n\nA sample example that uses both classes and multiple interfaces are shown below:\n\n\n\nBasketballTeam.java\n\n\n\n\n\n\n\n\n\n1\n2\n3\n\n\n\npublic interface BasketballTeam {\n public void printBasketballName();\n}\n\n\n\n\n\n\n\n\n\n\nFootballTeam.java\n\n\n\n\n\n\n\n\n\n1\n2\n3\n\n\n\npublic interface FootballTeam {\n public void printFootballName();\n}\n\n\n\n\n\n\n\n\n\n\nTeam.java\n\n\n\n\n\n\n\n\n\n01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n\n\n\npublic class Team implements BasketballTeam, FootballTeam {\n \n private String name = null;\n \n public Team(String name) {\n this.name = name;\n }\n \n @Override\n public void printFootballName() {\n System.out.println(\"Football Team: \\\"\" + name + \" F.C.\\\"\");\n }\n \n @Override\n public void printBasketballName() {\n System.out.println(\"Basketball Team: \\\"\" + name + \" B.C.\\\"\");\n }\n \n public static void main(String[] args) {\n Team t = new Team(\"Team A\");\n t.printBasketballName();\n t.printFootballName();\n }\n}\n\n\n\n\n\n\n\n\n\n\nA sample execution is shown below:\n\n\n\nBasketball Team: \"Team A B.C.\"\nFootball Team: \"Team A F.C.\"\n\n\n\n\n5. Single inheritance\n\n\n\nA java class can be subclassed from a parent class. The subclass can use the methods and properties of the parent class. The example below shows how the parent class Employee is implemented.\n\n\n\nEmployee\npublic class Employee {\n private String name;\n private String id;\n private int age;\n\n public Employee()\n {\n \n }\n public Employee(String name, String id, int age)\n {\n this.name = name;\n this.id = id;\n this.age = age;\n }\n public int getAge() {\n return age;\n }\n\n public String getName() {\n return name;\n }\n\n public String getId() {\n return id;\n }\n\n public void setAge( int age) {\n this.age = age;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n\n public void setId( String id) {\n this.id = id;\n }\n}\n\n\n\n\nSalariedEmployee class is subclassed from Employee. SalariedEmployee class has empSalary property. The implementation of the SalariedEmployee class is shown below.\n\n\n\nSalaried Employee\npublic class SalariedEmployee extends Employee {\n private double empSalary; \n \n public SalariedEmployee(String name, String id, int age, double empSalary) {\n super(name, id, age);\n setEmpSalary(empSalary);\n }\n \n \n public double getEmpSalary() {\n return empSalary;\n }\n \n public void setEmpSalary(double empSalary) {\n if(empSalary >= 0.0) {\n this.empSalary = empSalary;\n }\n }\n\n}\n\n\n\n\n6. Multilevel inheritance\n\n\n\nIn Multilevel Inheritance, inheritance is implemented at multiple levels.For example, a class Person serves as a base class for the derived class Employee. Employee class serves as a base class for the derived class Manager. \n\n\n\nYou can look at the implementation of the Person class which is the base class. Person class has attributes name, id, and age.\n\n\n\nPerson\n\/**\n * @author bhagvan.kommadi\n *\n *\/\n\n\npublic class Person{\n\t private String name;\n\t private String id;\n\t private int age;\n\t \n\t public Person()\n\t {\n\t \n\t }\n\t public Person(String name, String id, int age)\n\t {\n\t this.name = name;\n\t this.id = id;\n\t this.age = age;\n\t }\n\t public int getAge() {\n\t return age;\n\t }\n\t \n\t public String getName() {\n\t return name;\n\t }\n\t \n\t public String getId() {\n\t return id;\n\t }\n\t \n\t public void setAge( int age) {\n\t this.age = age;\n\t }\n\t \n\t public void setName(String name) {\n\t this.name = name;\n\t }\n\t \n\t public void setId( String id) {\n\t this.id = id;\n\t }\n\t}\n\n\n\n\n\nNow, we look at the Employee which is the derived class of the Person base class. Employee class has attributes department and designation.\n\n\n\nEmployee\npublic class Employee extends Person{\n\t private String department;\n\t private String designation;\n\n\t public Employee()\n\t {\n\t \n\t }\n\t public Employee(String name, String id, int age,String department,String designation)\n\t {\n\t\t super(name,id,age);\n\t this.department = department;\n\t this.designation = designation;\n\t }\n\t\/**\n\t * @return the department\n\t *\/\n\tpublic String getDepartment() {\n\t\treturn department;\n\t}\n\t\/**\n\t * @param department the department to set\n\t *\/\n\tpublic void setDepartment(String department) {\n\t\tthis.department = department;\n\t}\n\t\/**\n\t * @return the designation\n\t *\/\n\tpublic String getDesignation() {\n\t\treturn designation;\n\t}\n\t\/**\n\t * @param designation the designation to set\n\t *\/\n\tpublic void setDesignation(String designation) {\n\t\tthis.designation = designation;\n\t}\n\t \n\t \n\t}\n\n\n\n\nBelow is the implementation of the Manager class which is derived from the Employee class. The Manager class has the attribute reports who are the employees working under the manager and the java extends keyword is used to .\n\n\n\nManager\n\/**\n * @author bhagvan.kommadi\n *\n *\/\npublic class Manager extends Employee {\n private Employee[] reports;\n \n \n\npublic Manager() {\n\t \n }\n\n\/**\n* @return the reports\n*\/\npublic Employee[] getReports() {\n\treturn reports;\n}\n\n\/**\n* @param reports the reports to set\n*\/\npublic void setReports(Employee[] reports) {\n\tthis.reports = reports;\n}\n \n \n}\n\n\n\n\n7. Hierarchical Inheritance\n\n\n\nIn Hierarchical Inheritance, A single class has multiple derived classes. For example, the class Employee serves as a base class for the derived class SalariedEmployee, ContractEmployee and VendorEmployee.\n\n\n\nYou can see below the Employee class implementation. Employee class has attributes name, id, and age.\n\n\n\nEmployee\npublic class Employee {\n private String name;\n private String id;\n private int age;\n\n public Employee()\n {\n \n }\n public Employee(String name, String id, int age)\n {\n this.name = name;\n this.id = id;\n this.age = age;\n }\n public int getAge() {\n return age;\n }\n\n public String getName() {\n return name;\n }\n\n public String getId() {\n return id;\n }\n\n public void setAge( int age) {\n this.age = age;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n\n public void setId( String id) {\n this.id = id;\n }\n}\n\n\n\n\nNow we look at PermanentEmployee implementation. PermanentEmployee derives from Employee class. PermanentEmployee has an attribute salary.\n\n\n\nPermanentEmployee\n\/**\n * @author bhagvan.kommadi\n *\n *\/\npublic class PermanentEmployee extends Employee {\n\t\n\tprivate int salary;\n\n\t\/**\n\t * @return the salary\n\t *\/\n\tpublic int getSalary() {\n\t\treturn salary;\n\t}\n\n\t\/**\n\t * @param salary the salary to set\n\t *\/\n\tpublic void setSalary(int salary) {\n\t\tthis.salary = salary;\n\t}\n\t\n\t\n\n}\n\n\n\n\n\nContractEmployee class is derived from Employee. class. ContractEmployee has attributes contractAmount and contract period. The implementation is shown below:\n\n\n\nContractEmployee\n\/**\n * @author bhagvan.kommadi\n *\n *\/\npublic class ContractEmployee extends Employee{\n\tprivate int contractPeriod;\n\n private int contractAmount;\n\n\t\/**\n\t * @return the contractPeriod\n\t *\/\n\tpublic int getContractPeriod() {\n\t\treturn contractPeriod;\n\t}\n\n\t\/**\n\t * @return the contractAmount\n\t *\/\n\tpublic int getContractAmount() {\n\t\treturn contractAmount;\n\t}\n\n\t\/**\n\t * @return the contractPeriod\n\t *\/\n\tpublic int getContractPeriod() {\n\t\treturn contractPeriod;\n\t}\n\n\t\/**\n\t * @param contractPeriod the contractPeriod to set\n\t *\/\n\tpublic void setContractPeriod(int contractPeriod) {\n\t\tthis.contractPeriod = contractPeriod;\n\t}\n\n}\n\n\n\n\n\nNow, we see at the implementation of the VendorEmployee class. VendorEmployee class has an attribute Vendor name.\n\n\n\nVendorEmployee\n\/**\n * @author bhagvan.kommadi\n *\n *\/\npublic class VendorEmployee extends Employee {\n\tprivate String vendor;\n\n\t\/**\n\t * @return the vendor\n\t *\/\n\tpublic String getVendor() {\n\t\treturn vendor;\n\t}\n\n\t\/**\n\t * @param vendor the vendor to set\n\t *\/\n\tpublic void setVendor(String vendor) {\n\t\tthis.vendor = vendor;\n\t}\n\n}\n\n\n\n\n\n8. Download the Source Code\n\n\n\nDownload\nYou can download the Eclipse project of this example: Java Inheritance Example\n\n\n\nLast updated on Mar. 03rd, 2020\n\n\n\nDon't forget to check out our Academy premium site for advanced Java training!\n","publisher":{"@id":"#Publisher","@type":"Organization","name":"Examples Java Code Geeks","logo":{"@type":"ImageObject","url":"\/wp-content\/uploads\/2013\/05\/JavaCodeGeeks-logo.png"},"sameAs":["https:\/\/feeds.feedburner.com\/examplesjavacodegeeks","https:\/\/www.facebook.com\/javacodegeeks","https:\/\/twitter.com\/javacodegeeks","https:\/\/www.linkedin.com\/groups\/3810709\/","https:\/\/www.youtube.com\/channel\/UCxoUc7Rar2q90Gu0nT2ffuQ","https:\/\/github.com\/javacodegeeks\/"]},"sourceOrganization":{"@id":"#Publisher"},"copyrightHolder":{"@id":"#Publisher"},"mainEntityOfPage":{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-inheritance-example\/","breadcrumb":{"@id":"#Breadcrumb"}},"author":{"@type":"Person","name":"Sotirios-Efstathios Maneas","url":"https:\/\/examples.javacodegeeks.com\/author\/stathis-maneas\/"},"image":{"@type":"ImageObject","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":1200,"height":150}}
| og:locale | en_US |
| og:type | article |
| og:site_name | Examples Java Code Geeks |
| article:publisher | https://www.facebook.com/javacodegeeks |
| article:author | https://www.facebook.com/stathis.maneas |
| article:published_time | 2014-02-13T21:30:18+00:00 |
| article:modified_time | 2023-11-09T12:42:22+00:00 |
| og:image | https://examples.javacodegeeks.com/wp-content/uploads/2012/12/java-logo.jpg |
| og:image:width | 150 |
| og:image:height | 150 |
| og:image:type | image/jpeg |
| author | Sotirios-Efstathios Maneas |
| twitter:card | summary_large_image |
| twitter:creator | @javacodegeeks |
| twitter:label1 | Written by |
| twitter:data1 | Sotirios-Efstathios Maneas |
| twitter:label2 | Est. reading time |
| twitter:data2 | 6 minutes |
| None | IE=edge |
| msapplication-TileImage | https://examples.javacodegeeks.com/wp-content/uploads/2013/05/JavaCodeGeeks-favIcon.png |
Links:
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1