inheritance 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).
inheritance 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).
inheritance in java codingsmania
Class farmers
{
String crops="Wheat";
void grows();
{
System.out.println(“Farmers grows Wheat”);
}
}
Class Animals extends farmers
{
void eat();
{
System.out.println(“Animals eat Wheat”);
}
}
Class Cat extends Animals
{
void drink();
{
System.out.println(“Cat drinks milk”);
}
public static void main (String args[])
{
Animals obj=new Animals();
System.out.println(obj.crops);
obj.grows();
obj.eat();
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us