Inheritance:
Inheritance can be defined as the process where one object acquires the properties of another.
use extends or implements..interface not extended, it should be implemented
Inheritance can be defined as the process where one object acquires the properties of another.
use extends or implements..interface not extended, it should be implemented
public class Animal{ } public class Mammal extends Animal{ } public class Reptile extends Animal{ } public class Dog extends Mammal{
Example:
public interface Animal {}
public class Mammal implements Animal{
}
public class Dog extends Mammal{
public interface Vegetarian{} public class Animal{} public class Deer extends Animal implements Vegetarian{}