Interface Example-1
The motive of following code is that a concrete class can hold an interface and how to call that interface.
The motive of following code is that a concrete class can hold an interface and how to call that interface.
class ClassA
{
void abc()
{
System.out.println("ClassA");
}
interface InterfaceA
{
void show();
}
}
class ClassZ extends ClassA implements ClassA.InterfaceA
{
public void abc()
{
System.out.println("acb() called");
}
public void show()
{
System.out.println("show() method called ");
}
}
class InterfaceExample1
{
public static void main(String ar[])
{
ClassZ z1=new ClassZ();
z1.abc();
z1.show();
}
}
/*
acb() called
show() method called
*/
|