Monday, July 27, 2009

Java Question: What is the difference between Int and Float?

Java Question: What is the difference between Int and Float?

Java Question: What is the difference between Int and Float?
int is an integer with no decimal





float is an number that has decimals
Reply:oh ya know...float and int are fundamentally different in storage. Float's allow for decminal, int's don't. The / operator is different between them, int's returns and int (i.e. always rounding down.), and float's returns a float.





an int it just a number stored in binary.





a float is stored as N * 10^x, where the N and X are stored in binary, so all numbers aren't all possible and rounding might occur.
Reply:An "Int" is an integer or whole number like 1,2,3,100,345, or 123,456,756.


A Float is a number with a decimal point in it like 1.5, 3.45, $29.95, or 0.0001.
Reply:The basic answer is that Ints are whole numbers whereas Floats allow you to have a decimal value. For a more descriptive answer see the link in sources or just google "Java Data Types"
Reply:int is integers and float is real values.


int can hold at a time 2 values but no decimal but float can hold decimal too.

flowers online

No comments:

Post a Comment