The if else if Statement
Sometimes you want to check for a number of related conditions and choose one of several actions. One way to do this is by chaining a series of ifs and elses. Look at the following code segment : if (x > 0) { System.out.println(“x is positive”); } else if (x < 0) { System.out.println(“x is negative”); }…