Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Write code to implement bubble sort in java?

983


What are void methods?

1012


What is the difference between stringbuffer and stringbuilder class?

1090


What is the difference between Error, defect,fault, failure and mistake?

1196


What is queue in java?

1136


What is meant by nested loop?

1025


What is static keyword in java?

991


Can constructor be protected in java?

957


What is a qualifier in a sentence?

984


Why string is immutable with example?

957


What all methods are used to prevent thread execution ?

1015


What do you mean by chromounits in java8?

939


What are variable arguments or varargs?

996


What is navigable map in java?

976


How do you do exponents in java?

1033