If Statement in java, pass or fail ?

Java Programming Language Decision Making in java (Article) Decision Making in java (Program)

2612

Program:

 class Ifclass {
    public static void main(String[] args) {

        int marks = 76;
        String grade = "dont know";

        if (marks >= 40) {
            grade = "Pass";
        }

        if (marks < 40) {
            grade = "Fail";
        }

        System.out.println("Grade = "+grade);
    }
}

  

Output:

Grade = Pass
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.