Skip to content

Instantly share code, notes, and snippets.

@Ram-1234
Created June 29, 2021 04:02
Show Gist options
  • Save Ram-1234/d056b48b31d90d68cefc20913ca8f5a8 to your computer and use it in GitHub Desktop.
Save Ram-1234/d056b48b31d90d68cefc20913ca8f5a8 to your computer and use it in GitHub Desktop.
Inheritence in Java
//Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object.
//It is an important part of OOPs (Object Oriented programming system).
class Employee{
float salary=40000;
}
class Programmer extends Employee{
int bonus=10000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment