OnJava8-Examples/generics/SimpleDogsAndRobots.java

24 lines
465 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// generics/SimpleDogsAndRobots.java
2015-06-15 17:47:35 -07:00
// <20>2015 MindView LLC: see Copyright.txt
// 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());
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
Woof!
Sitting
Click!
Clank!
2015-09-07 11:44:36 -06:00
*/