One of my guilty pleasures is reading
The Daily WTF?!. I just saw
this Java snippet, and wanted to share:
int x = new Integer( 0 ).intValue();
someMethod( new Integer( x ) );
I laughed my ass off when I read it. Then, of course, I had to have a laugh at myself, because I've written code like that.
Within the last six months.
I did have an excuse though. For some reason, the compiler was complaining that it couldn't cast an
int
to an
Integer
(or vice versa). Then it was saying the opposite within the function. So I had to wrap and unwrap it. The weird thing was it was only giving this error on one machine.
As I recall, we just had to switch a compiler version in Eclipse to fix it. But, I
still wrote it.
Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!
Leave a comment
There are no comments for this entry yet.
Leave a comment