Java Program to demonstrate Interfaces

Program

interface IntDemo
{
    void display();
    void fun();
}
abstract class AbsDemo implements IntDemo
{
	int y = 20;
	abstract void show();
	public void display()
	{
		System.out.println("Implementing display method of interface IntDemo");
	}
	public void fun()
	{
		System.out.println("Implementing display method of interface IntDemo");
	}
	AbsDemo()
	{
		System.out.println("This is constructor of Abstract Class");
	}
}
public class InterfaceDemo extends AbsDemo
{
	InterfaceDemo()
	{
		System.out.println("Constructor of InterfaceDemo Class");
	}
	void show()
	{
		System.out.println("Method inherited from AbsDemo Class");
	}
	public static void main(String[] args)
	{
		InterfaceDemo intObj = new InterfaceDemo();
		intObj.display();
		intObj.fun();
		intObj.show();
	}
}

Output 1

This is constructor of Abstract Class
Constructor of InterfaceDemo Class
Implementing display method of interface IntDemo
Implementing display method of interface IntDemo
Method inherited from AbsDemo Class