This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: float variable
 
It's not a secret anymore!