aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes float question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "float question" Watch "float question" New topic
Author

float question

ty lee
Greenhorn

Joined: Dec 27, 2005
Posts: 5
Dear helper:
double d=12.5
float f=12.5

is syntax f=12.5 correct?

what is different between f=12.5 and d=12.5?
vivekkumar sharma
Ranch Hand

Joined: Dec 21, 2005
Posts: 70
Originally posted by ty lee:
Dear helper:
double d=12.5
float f=12.5

is syntax f=12.5 correct?

what is different between f=12.5 and d=12.5?

the floating point constants(Literals) in java are treated as doubles
so float f = 12.5 will give compile time error
u need to declare and intialise it as
float f=12.5f;
to specificaly tell compiler u want f to be intialised as a float.
hope this helps
ty lee
Greenhorn

Joined: Dec 27, 2005
Posts: 5
Dear vivekkumar sharma ,thank for helping
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: float question