---
title: "How to implements of inheritance in java?"  
description: "How to implements of inheritance in java?"  
author: "Mark M"  
published: 2014-10-10  
updated: 2014-10-10  
canonical: https://www.mindstick.com/forum/2353/how-to-implements-of-inheritance-in-java  
category: "java"  
tags: ["java", "oops"]  
reading_time: 1 minute  

---

# How to implements of inheritance in java?

example of [inheritance](https://www.mindstick.com/articles/13095/inheritance-and-its-types) in [java](https://www.mindstick.com/articles/12214/web-development-company-in-india-laid-on-the-foundation-of-concrete-java-programming)

## Replies

### Reply by Anonymous User

try this:

```
class Parent {    Parent(int a, int b) {        int c = a + b;        System.out.println("Sum=" + c);    }    void display() {        System.out.println("Return Statement");    }}class Child extends Parent {    Child(int a, int b) {        int c = a - b;        System.out.println("Difference=" + c);    }}public class InheritanceExample {    public static void main(String args[]) {        Child c = new Child(2, 1);        c.display();    }}
```


---

Original Source: https://www.mindstick.com/forum/2353/how-to-implements-of-inheritance-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
