next up previous contents
Next: Interface 2: Implementing 2 Up: Java Notes Previous: Interface Implementation

Interface 1: Implementing

/**
 *  This code is from the book:
 *  Winder, R and Roberts, G (1998)
 *  Developing Java Software
 *  John Wiley & Sons.
 *  It is copyright (c) 1997 Russel Winder
 *  and Graham Roberts.
 */

interface P{
  void f();
  int i = 10;
}

interface Q extends P{
  void f();
  int i = 10;
}

interface R extends P{
  void f();
  int i = 10;
}

class l1Interf1 implements Q,R{//Interface2
  public void f(){
    int j = R.i;
    int k = Q.i;
    int l = P.i;
  }
}
/******** sample compilation & run ******
# javac l1Interf1.java 
# java l1Interf1  
In class l1Interf1: void main(String argv[]) is not defined

#
******************************************/



Ananda Amatya
9/15/1999