I am trying to achieve the following: I have this method
public String methodName(Userdefinedclass.class,Userdefinedclass obj)
{
//some code
.........
method(Userdefinedclass.class);
method2(obj);
}
I want to generalise this method.
The challenge is that the argument here is user defined, i.e it can change. So please help.
public <T> String methodName(Class<T> c, T obj)
{
method1(c);
method2(obj);
return "some string";
}
void method1(Class c)
{
// Some stuff.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With