What are integer overflows and underflows and how to handle
them?
Answers were Sorted based on User's Feedback
Answer / nirmala
If the specified value exceeds the range that will result
overflow.
similarly,
if the specified value below the range that will result in
underflow
ie
byte b=259;(butits rangeis(-127 to 128) totally 256
in this u will get overflow error.
| Is This Answer Correct ? | 26 Yes | 11 No |
It uses those low order bytes of the result that can fit
into the size of the type allowed by
the operation.
| Is This Answer Correct ? | 11 Yes | 4 No |
Answer / ramesh kumar
byte b = (byte)250;
Here I assinged the value to b more than the positive range
of byte. So, It leads to overflow and we won't get any
error in compile time or run time.
But some unexpected value will be stored into b. i.e b = -
6. This will affect your logic.
| Is This Answer Correct ? | 3 Yes | 0 No |
What is the use of beaninfo?
Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?
How do you use, call, and access a non-static method in Java?
As a developer what steps do you take to improve the performance?
What is object in java?
What is a default package ?
What is functional interface in java example?
what is the purpose of the runtime class?
Can list contain null in java?
What are extraneous variables examples?
What do you understand by overloading and overriding in java?
i need income tax program using java inheritance concept. could u please help me?