Tutorial by Examples

Inheritance is one of the main concepts in Object Oriented Programming (OOP). Using inheritance, we can model a problem properly and we can reduce the number of lines we have to write. Let's see inheritance using a popular example. Consider you have to model animal kingdom (Simplified animal kingdo...
Teacher Class: class Teacher { private String name; private double salary; private String subject; public Teacher (String tname) { name = tname; } public String getName() { return name; } private double getSal...

Page 1 of 1