File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

float variable

 
Brodie Patten
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there float variables in Java, and if so, what are they???
 
frank davis
Ranch Hand
Posts: 1479
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
32 bits, designated by F or f at end of literal : float x = 1.24F.
 
Brodie Patten
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aren't there also Real variable? What's the difference between Real and Float?
 
frank davis
Ranch Hand
Posts: 1479
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, there's Double which is 64 bits, and several integer types : int, short, long,byte, char.
 
Sri Bala
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic