[Solved] incompatible types: String cannot be converted to int even there’re no strings [closed]


You are passing two arguments as String type, “20”, “10”:

int myBmi = myBmiCal("20", "10");

But it should be int type:

int myBmi = myBmiCal(20, 10);

“” – it means just empty String in Java. “20” – it means String with value 20. “20” and 20 are different types in Java. Here is documentation to learn more about it.

2

solved incompatible types: String cannot be converted to int even there’re no strings [closed]