• Post Reply Bookmark Topic Watch Topic
  • New Topic

byte problem  RSS feed

 
Hemant Agarwal
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


b + 1 is not allowed.
b++ is allowed.
Why?
 
Arun Kumarr
Ranch Hand
Posts: 662
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java, the result of any arithmetic is an integer and cannot be automatically typecasted to an byte.

But in b++, the value 1 which is added to b is taken as a byte and added to b.

[ November 30, 2005: Message edited by: Arun Kumarr ]
[ December 06, 2005: Message edited by: Jim Yingst ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!