• Post Reply Bookmark Topic Watch Topic
  • New Topic

another small question  RSS feed

 
sam robert
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
another small question here,


y is the above code giving me error. is the syntax of my switch statement wrong ? i dont think so , please, can somebody explain this to me ...i m stuck on it for quite some time now.
 
Mahesh Bhatt
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

The above code will give you error because, The case constant expression, 1000, exceeds the range of the switch expression type, "byte". The type of a switch expression can be byte, short, int or char. A constant expression is associated with each case label. Each case constant expression must be assignable to the type of the switch expression. In this case, the switch expression, b, is of type byte; so the maximum positive value of each case constant expression is limited to the maximum byte value, 127.

I hope it helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!