Example :
List<String> list = new ArrayList<String>();
//This would give me the class name for the list reference variable.
list.getClass().getSimpleName();
I want to get the Interface name from the list
reference variable.
Is there any way possible to do that?
Using Reflection you can invoke the
Class.getInterfaces()
method which returns anArray of Interfaces
that your class implements.To get just the name