fork download
  1. class Ideone {
  2. public static void main(String[] args) {
  3. final Test<String> testString = new Test<>();
  4. final Number number = testString.<Number>doSomethingWithU(1);
  5. System.out.println(number);
  6. }
  7. }
  8.  
  9. class Test<T> {
  10. public T doSomethingWithT(T t) {
  11. return t;
  12. }
  13.  
  14. public <U> U doSomethingWithU(U u) {
  15. return u;
  16. }
  17. }
Success #stdin #stdout 0.08s 51264KB
stdin
Standard input is empty
stdout
1