home *** CD-ROM | disk | FTP | other *** search
/ Java Certification Exam Guide / McGrawwHill-JavaCertificationExamGuide.iso / pc / Web Links and Code / code / chap6 / GrannySmith.java < prev    next >
Encoding:
Java Source  |  1997-04-19  |  368 b   |  12 lines

  1. interface Fruit { }
  2. interface Apple extends Fruit { }
  3. class GrannySmith implements Apple { 
  4.    public static void main(String[] args) {
  5.       GrannySmith gs = new GrannySmith();
  6.       if (gs instanceof Apple)
  7.          System.out.println("gs inherits from Apple");
  8.       if (gs instanceof Fruit)
  9.          System.out.println("gs inherits from Fruit");
  10.    }
  11. }
  12.