Is there a way that after you store something, such a Rectangle, to an object variable, say, Object x, that you can then look at object x, and determine it is indeed a rectangle, allowing you to use Graphic methods such as draw on said object?
Trying to answer quickly: I think you can write a class for Rectangle - what you define/mean for a rectangle---can write some methods to determine that it is a rectangle - check the length of the arms that each pair are equal. Check for angles [90 degrees] between arms.
for any object check, it is an instance of rectangle object... : 'instance of' is java built in.
You can also, execute the test method to determine it really is a rectangle...