If else Statement in java, pass or fail.

Java Programming Language / Decision Making in java

145281

Program:

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

        int marks = 76;
        String grade;

        if (marks >= 40) {
            grade = "Pass";
        }
        else
        {
            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.