001 /** 002 * Exercise 8.5 from the book. 003 * 004 * @author Kristian Torp, torp (at) cs (dot) aau (dot) dk 005 * @version 1.0 006 */ 007 public class Exercise8_5 extends ConcreteClass implements Interface123 { 008 // from Interface1 009 public String a() { 010 System.out.println("a"); 011 return ""; 012 } 013 014 public String b() { 015 System.out.println("b"); 016 return ""; 017 } 018 019 // from Interface2 020 public int c(int c) { 021 System.out.println("c " + c); 022 return c; 023 } 024 025 public int d(int d) { 026 System.out.println("d " + d); 027 return d; 028 } 029 030 // from Interface3 031 public float e(float e) { 032 System.out.println("e " + e); 033 return e; 034 } 035 036 public float f(float f) { 037 System.out.println("f " + f); 038 return f; 039 } 040 041 // from Interface 123 042 public String g() { 043 System.out.println("g"); 044 return ""; 045 } 046 047 public void use1(Interface1 i) { 048 System.out.println("I'm an Interface1"); 049 } 050 051 public void use2(Interface2 i) { 052 System.out.println("I'm an Interface2"); 053 } 054 055 public void use3(Interface3 i) { 056 System.out.println("I'm an Interface3"); 057 } 058 059 public void use123(Interface123 i) { 060 System.out.println("I'm an Interface123"); 061 } 062 063 public static void main(String[] args) { 064 Exercise8_5 c = new Exercise8_5(); 065 c.use1(c); 066 c.use2(c); 067 c.use3(c); 068 c.use123(c); 069 } 070 }