Java and unsigned numeric types

I was surprised to find out that Java doesn’t have a way of dealing with unsigned numeric types. I’m surprised — given its heritage, you’d think it would implement something that’s so integral (if you’ll pardon the pun) to C++.

Another gotcha I ran into was having a constructor that expects a “short” seem to be ignored because you have to explicitly cast to short for it to be recognised. Otherwise, Java thinks it’s looking for a constructor that takes an “int”.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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