HaniiPuppy

Untitled

Apr 10th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. public class Foo<T>
  2. {
  3.     T t;
  4.  
  5.     public T getT()
  6.     { return t; }
  7. }
  8.  
  9. public class Bar<T> extends Foo<Qux>
  10. {
  11.     T anotherT;
  12.  
  13.     public T getOtherT()
  14.     { return anotherT; }
  15. }
  16.  
  17. public class SomeClass
  18. {
  19.     public static void someMethod()
  20.     {
  21.         Bar<Buzz> bar; // which extends Foo<Qux>
  22.  
  23.         bar.getT();
  24.         // This method call returns Object rather than Qux?
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment