A java program has many statements, these statements are executed sequentially. If a program has two or more conditions and user want to perform a particular condition which satisfy user's need, then Decision Making concept is used. JAVA has some following Decision Making Statements: IF statements switch statements if statements: if statements are used to check the condition in true or false. Simple if statement if-else statement if-else-if ladder Nested if Simple if: If condition is true then particular statement block will be executed otherwise skipped. syntax: if(condition){ //block of statement; } Program: public class Eligibility{ public static void main(String[] args){ int age = 19; ...
Comments
Post a Comment