Posts

Showing posts from July, 2021

Java Conditional Statements

Image
Java , like all other programming languages, is equipped with specific statements that allow us to check a  condition  and execute certain parts of code depending on whether the  condition  is true or false. Such statements are called conditional and are a form of a composite statement. The Java  if statement  is used to test the condition. It checks the boolean condition:  true  or  false . There are various types of if statements in Java. if statement if-else statement if-else-if ladder nested if statement Java supports the usual logical conditions from mathematics: Less than:  a < b Less than or equal to:  a <= b Greater than:  a > b Greater than or equal to:  a >= b Equal to  a == b Not Equal to:  a != b 1. Java if Statement The Java if statement tests the condition. It executes the  if block  if the condition is true. Syntax: 1.    if (condit...