Menu
Question Index
...

What will be the output of the following program? Assume that the argument passed as - Cow Boy I Am.

public class YouGradeIs {
    public static void main(String args[]) {
        char grade = args[3].charAt(0);
        switch (grade) {
            case 'A' :
                System.out.println("Excellent!");
                break;
            case 'B' :
            case 'C' :
                System.out.println("Well done");
                break;
            case 'D' :
                System.out.println("You passed");
            case 'F' :
                System.out.println("Better try again");
                break;
            default :
                System.out.println("Invalid grade");
        }
        System.out.print("Your grade is " + grade);
    }
}


Excellent!
Your grade is A
Invalid grade
Your grade is I
Well done
Your grade is B
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Command Line Arguments In Core Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App