OnJava8-Examples/generics/SimpleDogsAndRobots.java
2015-12-15 11:47:04 -08:00

26 lines
604 B
Java

// generics/SimpleDogsAndRobots.java
// (c)2016 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://mindviewinc.com/Books/OnJava/ for more book information.
// Removing the generic; code still works.
class CommunicateSimply {
static void perform(Performs performer) {
performer.speak();
performer.sit();
}
}
public class SimpleDogsAndRobots {
public static void main(String[] args) {
CommunicateSimply.perform(new PerformingDog());
CommunicateSimply.perform(new Robot());
}
}
/* Output:
Woof!
Sitting
Click!
Clank!
*/