0% found this document useful (0 votes)
3 views1 page

Interface Example

The document defines two interfaces, MyInterface1 and MyInterface2, each with a single method. Two classes, XYZ and ABC, implement these interfaces, with ABC implementing both. The main method creates an instance of ABC and calls the disp1 method, demonstrating the implementation of the interfaces.

Uploaded by

vijaya2511
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Interface Example

The document defines two interfaces, MyInterface1 and MyInterface2, each with a single method. Two classes, XYZ and ABC, implement these interfaces, with ABC implementing both. The main method creates an instance of ABC and calls the disp1 method, demonstrating the implementation of the interfaces.

Uploaded by

vijaya2511
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package interfacefeb18;

interface MyInterface1
{
public void method1();

}
interface MyInterface2
{
public void disp1();

}
class XYZ implements MyInterface1
{
public void method1()
{
System.out.println("implementation of method1");
}

}
class ABC implements MyInterface1,MyInterface2
{
public void method1()
{
System.out.println("implementation of method1");
}

public void disp1()


{
System.out.println("implementation of disp1");
}
}
public class InterfaceFeb18 {

public static void main(String[] args) {


ABC a1 = new ABC();
a1.disp1();
}

You might also like