Conditional statements in Java
Conditional statements are statements which run on the behalf of a condition.
Imagine if your mom said to buy only 1 kg of sugar from nearby store, What you will do ?
You will go and ask only 1 kg. Right ?
Here only 1 kg of sugar is the condition which is told by mom.
To solve similar of works using programming, we use conditional statements.
Different types of conditional statements are
- else if ladder
- nested statements