+ 1
double Max = 12.7; if (Max >= 12) System.out.print("FRENCH"); else System.out.print("FRIES"); Can the code be converted to Switch ? If yes why ? If no why?
Please its importent
2 Antworten
+ 5
switch is only for equal not for greater than and less than
yes Yash is correct it is not supported for double in low level language or languages based on it.
+ 1
I am not sure but the switch case should only be used with integer Values .Here you have taken a variable aa double which further complicate things and comparison operator dosent work in the cases