Forums Register Login

Adding two bytes

+Pie Number of slices to send: Send
I am trying to add two bytes.But I am getting "Possible loss of precision" Error.
Also tell me how int and byte different from each other.And when to use byte.
Thanks

+Pie Number of slices to send: Send
Check this post.
+Pie Number of slices to send: Send
Thanks for the response Christophe Verré.

Also tell me how int and byte different from each other.And when to use byte.



Now I need answer for above quoted text
+Pie Number of slices to send: Send
int takes up 32 bits (4 bytes) and has a range of -(2^31) to (2^31)-1 (inclusive). byte takes up 8 bits (1 byte ) and has a range of -128 to 127 (inclusive). byte is useful if you only need this limited range.
+Pie Number of slices to send: Send
it's like ... int is the standard computation datatype for decimal numbers in java so every short is automatically converted to an int before computation ... please see about widening and narrowing conversions
+Pie Number of slices to send: Send
Thanks everyone.
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 11812 times.
Similar Threads
Mock Exam Question
doubt in Expressions
Why cast int to byte?
Type Conversion doubt
byte + byte = int?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:55:08.