File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes byte problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "byte problem" Watch "byte problem" New topic

byte problem

raj koura

Joined: Oct 10, 2000
Posts: 11
i am using a byte variable because the value to be stored is an integer between 1-50.
byte x;
x = 1;
x = x + 2; // problems (explicit cast required)
is there any other way to execute this without having to use typecasting?
Don't get me started about those stupid light bulbs.
subject: byte problem
Similar Threads
Difference between additive & assignment operator
The Shift Operators
Bitwise inversion operator question
Increment and Decrement Operators