Control statements
Control statements Control statements :- A control statement works as a determiner for deciding the next task of the other statements whether to execute or not. if Statement : Simple if statement is the basic of decision-making statements in Java. It decides if certain amount of code should be executed based on the condition. Syntax: if (condition) { Statemen 1; //if condition becomes true then this will be executed } Statement 2; //this will be executed irrespective of condition becomes true or false example : class IfStatement { public static void main(String[] args) { int number = 10; if (number > 0) { System.out.println("Number is positive."); } System.out.println("This statement is always executed."); } } if…else Statement : In if…else statement, if condition is true then statements in if block will be executed but if it comes out as false then