OnJava8-Examples/generics/SimpleDogsAndRobots.java
2015-11-03 12:00:44 -08:00

23 lines
424 B
Java

// generics/SimpleDogsAndRobots.java
// 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!
*/