Home Tutorial Java Certification Interface Example-3


Share on Google+Share on Google+
Interface Example-3
Posted on: July 1, 2010 at 12:00 AM
The motive of this example is to show that a class can implement more than one interface
interface InterfaceX {
  public void methodx();

interface InterfaceY {
  public void methody();

interface InterfaceZ {
  public void methodz();

class ClassXY implements InterfaceX, InterfaceY, InterfaceZ {
  public void methodx() {
    System.out.println("method x of InterfaceX");

  public void methody() {
    System.out.println("method x of InterfaceY");

  public void methodz() {
    System.out.println("method x of InterfaceZ");

class InterfaceEx3 {
  public static void main(String arg[]) {
    ClassXY y = new ClassXY();

 * ------------------OUTPUT------------------------ method x of InterfaceX
 * method x of InterfaceY method x of InterfaceZ

Related Tags for Interface Example-3:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 1, 2010

Recommend the tutorial

Advertisements Advertisements