Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

subtracting 2 bytes makes int?

807598Sep 25 2006 — edited Sep 25 2006
Hi, I'm learning the basics of type casting here and I've got a problem going on that I don't understand.

My trouble line looks like so:

short = byte - byte;

Now the error it gives me is "Type mismatch: cannot convert from int to short."

I'm trying to understand why a byte - byte is an int and also trying to figure out what the solution is, thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2006
Added on Sep 25 2006
2 comments
871 views