inheritance concept java code example
Example: Inheritance in java
class A
{
public void display()
{
System.out.println("class A display method");
}
}
interface B
{
public void print();
}
interface C
{
public void print();
}
public class HybridInheritanceDemo extends A implements B, C
{
public void print()
{
System.out.println("implementing print method");
}
public void show()
{
System.out.println("show method of class HybridInheritanceDemo");
}
public static void main(String[] args)
{
HybridInheritanceDemo obj = new HybridInheritanceDemo();
obj.show();
obj.print();
}
}