In the following code I am getting error .
The error is as follows :
Main.java:15: error: incompatible types: String cannot be converted to T
return new String("abc");
where T is a type-variable:
T extends Object declared in method <T>foo(T)
Why am I getting this error ? Wont T = String ?