Pass floats as string literals to a methodTag(s): String/Number
About cookies on this site
We use cookies to collect and analyze information on site performance and usage,
to provide social media features and to enhance and customize content and advertisements.
Color c = new Color(0.1,0.2,0.4);
returns "Incompatible type for constructor. Explicit cast needed to
convert double to int." even if the constructor Color (float r, float g, float b) is valid.
That's because the compiler interprets numbers like 0.1 as double not float. You must use
the suffixe "f" to indicate that the number is a float.