Java if else program Java if else program uses if else to execute statement(s) when a condition holds true. Below is a simple program which explains the usage of if else in Java programming language. In this program, a user inputs marks obtained in an exam, and it is compared with the minimum passing marks. An appropriate message is printed on the screen based on whether the user passed the exam or not. Java programming if else statement // If else in Java code import java.util.Scanner ; class IfElse { public static void main ( String [ ] args ) { int marksObtained, passingMarks ; passingMarks = 40 ; Scanner input = new Scanner ( System . in ) ; System . out . println ( "Input marks scored by you" ) ; ...
Learn Graphics Design, Video Editing, Form Fill, Web Oriented
Comments
Post a Comment