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

How do you invoke a method?

755


Is special character in java?

850


What is the default value of local and global variables?

850


What is an infinite loop? How infinite loop is declared?

800


How we can declare a static variable?

884


What are the 4 versions of java?

873


What is bool mean?

762


Explain about public and private access specifiers?

785


How do you use equal in java?

749


I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?

813


What is arraylist e?

798


What does s mean in regex?

782


What are the advantages of defining packages in java?

750


Why does java doesnt suuport unsigned values?

1997


What is append function?

781