aspose file tools*
The moose likes Java in General and the fly likes passing a float to a double Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "passing a float to a double" Watch "passing a float to a double" New topic
Author

passing a float to a double

Christie George
Greenhorn

Joined: Aug 16, 2004
Posts: 19
hi,
my issue is like this..

i have a float variable,is it possible for me to pass this (float) variable to a method thats taking a double as arguement? i am not applying any cast to the float variable.
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
Yes !
Since double is a bigger container, it can hold float values (which would fit in it). Explicit casting is not required.



[ February 08, 2005: Message edited by: kolkata prince ]
[ February 28, 2005: Message edited by: kolkata prince ]

Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
Christie George
Greenhorn

Joined: Aug 16, 2004
Posts: 19
ok fine agreed...but in such a case will the extra bits of the float value be filled with a junk value(when its passed)?
Senthil B Kumar
Ranch Hand

Joined: Feb 09, 2004
Posts: 140
Nope !!!
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
This called as auto promotion.


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
 
jQuery in Action, 2nd edition
 
subject: passing a float to a double