File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes float variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "float variable" Watch "float variable" New topic
Author

float variable

Brodie Patten
Greenhorn

Joined: Feb 28, 2001
Posts: 7
Are there float variables in Java, and if so, what are they???
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
32 bits, designated by F or f at end of literal : float x = 1.24F.
Brodie Patten
Greenhorn

Joined: Feb 28, 2001
Posts: 7
Aren't there also Real variable? What's the difference between Real and Float?
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
no, there's Double which is 64 bits, and several integer types : int, short, long,byte, char.
Sri Bala
Ranch Hand

Joined: Mar 06, 2001
Posts: 63
I want to add a point. By default, a number like 1.0 will be double in java. If you want a float. you have to specify 1.0f. so,
float f = 1.0; // will not compile
it should be
float f = 1.0f;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: float variable
 
Similar Threads
Conversion table
Tech Word Game
int/floats in constructor
WA #2 ..... word association
What would be the result and why ?