//This is an automatic promotion, so the cast here is redundant
ObjectobjMe=(Object)comMe;
...
...
@@ -91,13 +93,15 @@ public class CastObjectsDriver {
//toggle uncomment/comment to show compile-time error
//Rectangle recMe = (Rectangle) numMe;
//However, if we try to cast comMe to a Rectangle (Rectangle implements Comparable) the compiler will NOT complain, but of course, we will still throw ClassCastException
//because the underlying object stored in comMe is still of type Double, and Rectangle is not in Double's class hierarchy.
//toggle uncomment/comment this code below to throw a ClassCastException