classParent { Parent(int a, int b) { int c = a + b; System.out.println("Sum=" + c); } void display() { System.out.println("Return Statement"); } } classChild extends Parent { Child(int a, int b) { int c = a - b; System.out.println("Difference=" + c); } } publicclassInheritanceExample { publicstaticvoid main(String args[]) { Child c = newChild(2, 1); c.display(); } }
Liked By
Write Answer
How to implements of inheritance in java?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
10-Oct-2014