If - Else control statement
In this article we will learn about If-else control statement. There are four types of if-else control statement. if statement Syntax if(condition) { //code to be executed } Program public class If_Example { public static void main(String args[]) { int age = 20; if(age > 18) { System.out.println("You can give vote."); } } } Run Output You can give vote. Explanation If statement executes the block if the condition becomes true. if-else statement Syntax if(condition) { //code if condition is true } else { //code if condition is false } Program public class IfElse_Example { public static void main(String args[]) { int age = 17; if(age > 18) { System.out.println("You can give vote."); } else { System.out.println("You can't give vote."...