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


Please Help Members By Posting Answers For Below Questions

What does java final mean?

513


What is a null point?

549


Wha is the output from system.out.println(“hello”+null); ?

680


Can you use abstract and final both with a method?

566


Can we write a class without main method in java?

471






Describe the term diamond problem.

565


How many static init can you have?

668


What is protected access modifier?

563


What is meant by 'bit masking' in java?

638


What are thread local variables?

542


What is literal example?

554


What is meant by class and object in java?

551


How to create a custom exception?

561


What are the 5 types of research methods?

577


Can a method be overloaded based on different return type but same argument type?

539