You are on page 1of 1

class A<T>

{
Ta;
A(T x)
{
a=x;
System.out.println(a);
}
}
public class generic
{
public static void main(String[] args)
{
A <Integer> a1 = new A<Integer>(10);
A <String> a2 = new A<String> ("Hello");
}
}
Output
10
Hello

You might also like