Gen<Integer> y=new Gen(2); // Line1
Integer x=y.getOb(); //Line 2
Gen<Integer> y1=new Gen<>(2); // Line3
Integer x1=y1.getOb();//Line4
class Gen<T>
{
T val;
Gen(T ob)
{
val=ob;
}
T getOb()
{
return val;
}
}
I am not able to find any difference between y and y1 objects. Please help me in understanding this.
FYI- It is getting compiled and giving right output.