Detect Object type then cast it accordingly?
问题 My method takes as input an Object. How do i determine it's type, then cast it accordingly? So for example: binarySearch( Object o ); Inside the binarySearch method, i need a way to determine the type (or class) of Object o. Then i need to cast it with that type. how would i do that??? And more specifically, Object o is a child of a base class (EG SalariedEmp is child of Employee), and i specifically need the base class. EDIT: I figured out how to do what I wanted, which really should be a