I have a JTree that stores 1 of two different classes as objects in each DefaulyMutableTreeNode. Is it possible to check if casting the object to another class would raise an exception before I cast it. For example:
if( casting to string is valid )
String string = (String)myObject;
if( casting to string is valid )
String string = (String)myObject;