+ 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

1st Dec 2016, 2:12 AM
sara alshehri
sara alshehri - avatar
2 Respostas
+ 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.
1st Dec 2016, 2:50 AM
Sandeep Chatterjee
+ 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
1st Dec 2016, 2:42 AM
Yash Singhal
Yash Singhal - avatar