waltermilner

Untitled

Oct 7th, 2017
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. public class Test {
  2.  
  3.   public static void main(String[] args) {
  4.     Buy buy1 = new Buy();
  5.     buy1.buy(5, Thing.A, new Seller());
  6.  
  7.   }
  8.  
  9. }
  10.  
  11. class Seller {
  12. }
  13.  
  14. interface Buyer<E extends Enum<E>> {
  15.  
  16.   void buy(int numOfItem, E e, Seller seller);
  17. }
  18.  
  19. enum Thing {
  20.  
  21.   A, B, C;
  22. }
  23.  
  24. class Buy implements Buyer<Thing> {
  25.  
  26.   public void buy(int numOfItem, Thing e, Seller seller) {
  27. System.out.println("Buying "+numOfItem+ " " + e);
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment