Can we add two byte variables and assign the result to a
byte variable ?
b=b1+b2 where b,b1,b2 are byte types
Answer Posted / m. abhishek
yes, but u require type casting because the the binary
operation in java should atleast returns Integer values
example :
byte a=12;
byte b=23;
// byte c=a+b; //Not OK,bcoz a+b is an int value
int c=(byte)a+b; // OK
| Is This Answer Correct ? | 34 Yes | 7 No |
Post New Answer View All Answers
Write code to implement bubble sort in java?
What are void methods?
What is the difference between stringbuffer and stringbuilder class?
What is the difference between Error, defect,fault, failure and mistake?
What is queue in java?
What is meant by nested loop?
What is static keyword in java?
Can constructor be protected in java?
What is a qualifier in a sentence?
Why string is immutable with example?
What all methods are used to prevent thread execution ?
What do you mean by chromounits in java8?
What are variable arguments or varargs?
What is navigable map in java?
How do you do exponents in java?