Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

need reason behind float / f keyword while declaring it as a float numeric (no replies)

$
0
0
Hello,

I need the reason behind using (float) / 'f' keywords while defining a float variable in java...
eg. float f = 12.45f;

or
float f=(float)12.45;

instead of:
float f=12.45;
as we write in c++..
so i want to clear my concepts behind this reason that what is the difference between c++ and java regarding this declaration..why we cannot write it in the form as we write in c++...we have already mentioned to the compiler that it is a float type variable so why we need to specify this casting...
please reply me i m very confused...

thanks in advance

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>