title: Java rules for casting
body: <p>When can a certain object be cast into another object?  Does the casted object have to be a subtype of the other object?  I'm trying to figure out the rules...</p>
  
  <p><strong>Edit</strong>: I realized that I didn't explain my issue at all: basically I am casting an object to an interface type. However, at run-time, I get a <code>java.lang.ClassCastException</code>.  What needs to happen with my object so that I can cast it to this interface?  Does it have to implement it? </p>
  
  <p>Thanks</p>