0
Why whene write varible float give me erro like write float price =104.4;
5 Antworten
+ 10
I suspect that declaring the variable in the function call is what is tripping you up. Try to separate the lines.
A few other thoughts: It'd be much easier to answer questions if you'd indicate the language (since they all handle things a bit differently), if you would provide a true code snippet, and if you'd provide a bit more information about the error message.
+ 3
Please specify the language.
+ 3
If you do not specify the value type Java will assume a default value, which Java will by default use double for decimal numbers.
Floats cannot be converted to double, so you receive an error.
You can specify the value type to a float by adding an 'f' to the end of the value.
Like this:
float price = 104.4f;
If you do not want to have to put the f at the end, you could just use a double instead.
Like this:
double price = 104.4;
0
java
0
yes you are right this is the error like this exactally ,thank you for your help