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...


What are integer overflows and underflows and how to handle
them?

Answers were Sorted based on User's Feedback



What are integer overflows and underflows and how to handle them?..

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

What are integer overflows and underflows and how to handle them?..

Answer / ramprakash

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

What are integer overflows and underflows and how to handle them?..

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

Post New Answer

More Core Java Interview Questions

What is JDBC Driver interface?How can you retrieve data from the ResultSet

0 Answers   CTS,


How do I get a substring?

0 Answers  


What's the base class in java from which all classes are derived?

0 Answers  


What are the differences between Java 1.0 and Java 2.0?

0 Answers  


how can we import the user defined package without classpath?

1 Answers   CSC, Infosys,


Thanks A.jyotsna, Can u tell me differnce between abstract class and interface vikash

4 Answers  


how to call one program .class file in another program

7 Answers   TCS,


If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?

0 Answers   CDAC,


How do you invoke a method?

0 Answers  


why we r not use pointers in corejava?

2 Answers   Samsung,


Can constructor be protected in java?

0 Answers  


What are the benefits of operations?

0 Answers  


Categories