java - What do F and D mean at the end of numeric literals? -


i've seen of symbols, cannot find strange it,

double d = 5d; float f = 3.0f;

what d , f behind 5 means?

means these numbers doubles , floats, respectively. assume have

void foo(int x); void foo(float x); void foo(double x); 

and call

foo(5) 

the compiler might stumped. that's why can 5, 5f, or 5.0 specify type.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -