You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
I was able to compile the following without complaint:
class Foot extends Unit {
String type=1;
String system="English";
float baseValue="3.2808399";
}
I expected complaints that 1 is not a string and "3.2808399" is not a float. Instead, I get complaints from the Java compiler:
javac Functions.java
./convert/Foot.java:4: error: incompatible types: int cannot be converted to String
public String type = (String) (1);
^
./convert/Foot.java:6: error: incompatible types: String cannot be converted to float
public float baseValue = (float) ("3.2808399");
^
2 errors
The Python and Javascript work as is and return the same results as if I had supplied a float for Foot.baseValue.
The text was updated successfully, but these errors were encountered:
I was able to compile the following without complaint:
I expected complaints that 1 is not a string and "3.2808399" is not a float. Instead, I get complaints from the Java compiler:
The Python and Javascript work as is and return the same results as if I had supplied a float for Foot.baseValue.
The text was updated successfully, but these errors were encountered: