2(iii)
Convert the following switch case into if else if:
switch(x)
{
case 'T' :
case 't' : System.out.print("Teacher"); break;
default : System.out.print("Student");
}Show SolutionHide Solution↓
if (x == 'T' || x == 't') {
System.out.print("Teacher");
} else {
System.out.print("Student");
}