im trying to do some reflection on a applet.
things i found are some arrays of ints, strings, objects etc.
for example, if there was a field with an object[] and object[0].toString() = [I@7593c366
then i know its an integer array. but what if it says aa@98324ca33 is it’s class then aa?
im using a classloader, so my first guess when i see this i need to load the aa class (part before the @, and use the object in it. but im not sure the part befor the @ is the class. can somebody say me this is right? or got other ideas?
thnx!
You shouldn’t use
toString()for this – for one thing, it can have been overridden. As a straightforward example:You would clearly be wrong to think that
xrefers to an object of typeaahere – it refers to a string.You can find out the class of any object just by calling
getClass()on it:It’s not really clear what you’re trying to do or where you’re getting information from in the first place, but you definitely shouldn’t be using
toStringto determine the class involved.