How can I use switch rule with multiple statements? For ex. convert this:
switch (choice) {
case 1:
ans = inchesToCentimeters(num);
System.out.println(ans);
break;
}
To something like this (I don't know how to do it obviously but this is just a guess):
switch (choice) {
case 1 -> ans = inchesToCentimeters(num);
-> System.out.println(ans);
}
Any help is much appreciated and thank you in advance.