home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-04-19 | 368 b | 12 lines |
- interface Fruit { }
- interface Apple extends Fruit { }
- class GrannySmith implements Apple {
- public static void main(String[] args) {
- GrannySmith gs = new GrannySmith();
- if (gs instanceof Apple)
- System.out.println("gs inherits from Apple");
- if (gs instanceof Fruit)
- System.out.println("gs inherits from Fruit");
- }
- }
-