Java Example Program to calculate student grade using the Switch Case.
Findgrade.java
[java]
/**
@author:candidjava.com
@description:Program to calculate grade using Switch Case
*/
public class Findgrade {
public static void main(String org[]) {
int i = 2;// given input grade
switch (i) {
case 1:
System.out.println(“1st grade”);
break;
case 2:
System.out.println(“2nd grade”);
break;
case 3:
System.out.println(“3rd grade”);
break;
default:
System.out.println(“none”);
}
}
}
[/java]
Output:
2nd grade