Skip to content
February 17, 2009 / Ben Chun

LOL of the Day

I like to take student suggestions for the examples I use when I’m lecturing. Today I was talking about casting in the context of collections, and so I needed to make some arbitrary class types. The loudest shouts were for “Otter” and “Giraffe” so I took those and added a “Mammal” superclass. We put instances into an ArrayList, saw the limitations of treating them as instances of the superclass, went through a bunch of backflips to get them back out in their original forms without runtime exceptions, and then started looking at the power of creating abstract methods in the superclass.

Everything is going pretty smoothly, and we’re joking about how cute otters are and how “cute” isn’t a manly term (according to one of the senior boys) and how cute baby giraffes are and how nice it would be float around in the ocean all day. Eventually, I start asking them what things mammals have in common, and out of nowhere another boy says, “Your mom is a mammal.”

After the class recovered, I had to agree.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: