"exp" is an arraylist in a method "preform" under the class "Profitable".
The contents of Arraylist "exp" are from many classes.
now i want to know whether the arraylist "exp " is from a particular class "Armour".
i Tried with the following code. But i did,nt get the class name. But i got the type of class(like java.lang.String).
for(int i=0; i<exp.size(); i++)
String temp = exp.get(1).getClass();
but this returns only the type of class(java.lang.String) but not the class name from where it is mapped.
Rather than store simple Strings into the ArrayList, why not store key/value pairs where the key is the name of the originating class? There are classes in the API that will help you to do something like this.