simple java program
Nov 15, 2012 at 12:13pm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
class room
{
float l,b;
void getdata(float a, float c)
{
l=a;b=c;
}
}
class area
{
public static void main(String args[])
{
room obj=new room();
obj.getdata(1.2,2.3);
System.out.println(obj.b%obj.l);
}
}
|
it shows following error..
getdata(float,float) in room cannot be applied to (double,double)
why does it mean?
Nov 15, 2012 at 12:23pm
this is not a java forum. But what the heck:
It means that 1.2 and 2.3 are double values and not float. java does not convert that automatically
Nov 15, 2012 at 12:32pm
sorry ..this is my first and last java ques here..but how are 1.2 and 2.3 float and not double..!!
Nov 15, 2012 at 12:38pm
In C++, you can append a f to the number to force it to being a float, as in:
obj.getdata(1.2f,2.3f);
Why do you want to use floats anyway?
Topic archived. No new replies allowed.