Sie sind auf Seite 1von 1

/* Program for Interfaces */

interface a
{
int a1=10;//declaration of a1 by default this is final and static
public void display();//declaration of display
}
interface b
{
public void show();//declaration of show
}
interface c extends b
{
public void show1();//declaration of show1
}
class mnp
{
public void welcome()//defination of welcome
{
System.out.println("Welcome");
}
}
class xyz extends mnp implements a,c // this will extend mnp class and implement
s a & c interfaces
{
public void display()
{
System.out.println(a1);
}
public void show()
{
System.out.println("HEllo");
}
public void show1()
{
System.out.println("HEllo1");
welcome();
}
}
class abc
{
public static void main(String args[])
{
xyz x= new xyz();//create object of xyz class
x.display();
x.show();
x.show1();
}
}

Das könnte Ihnen auch gefallen