Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Assume the following declarations: int integer; double preciseReal; float sloppyReal; long bigInteger; Rewrite the following statement using an appropriate cast that makes the error go away bigInteger = sloppyReal;

OpenStudy (mathmate):

If you would like to cast a float (hours) to an int (iHours), you would write: iHours=(int)hours; but beware that the fractional part of hours will be truncated, i.e. no proper rounding. Other castings can be done similarly. Note that inversely an integer can be "promoted" to a float automatically without casting. A detailed explanation is given at the link below: http://www.myhowto.org/java/60-understanding-the-primitive-numeric-type-conversions-in-java/

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!