I am unsure about something.
In C#, I can do the following.
public class Helper<T> where T : new()
{
public static T SomeHelperFunction(string strValue)
{
return new T();
}
}
Here, the static method can clearly make use of the type passed through to the Helper class.
Here is my exact attempt in Java/Android
public class Helper<T> {
public static T SomeHelperFunction(String strValue){
//some code
}
}
Java complains about the T used in the SomeHelperFunction. Why does .Net allow this, but not Java, or am I missing something?
How can I create the .Net class in Java?