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

Explain the init method?

732


What are the actions that can occur when a thread enters blocked state?

811


What is a “stateless” protocol ?

753


What is overloading and overriding in java?

914


How do you escape in java?

806


What the difference is between execute, execute Query, execute Update?

581


What is a type parameter in java?

754


What is the difference between method overriding and overloading?

824


What is locale?

807


Explain about map interface in java?

791


What is a "pure virtual" member function?

853


Can we use synchronized block for primitives?

820


How do you define a singleton class?

779


What are the properties of thread?

685


What are loops in java?

784