1 class Demo{ 2 public <T> T fun(T t){ 3 return t; 4 } 5 } 6 public class GenericsDemo { 7 public static void main(String[] args) { 8 Demo d=new Demo(); 9 String str=d.fun("hsjkdka"); 10 int i=d.fun(30); 11 System.out.println(str); 12 System.out.println(i); 13 } 14 }