Computer Science, asked by ashokjaiswal719, 1 year ago

How to use if and else statement in java programming .

Explain with 5 examples

Answers

Answered by nilayks17
4

When we need to execute a set of statements based on a condition then we need to use control flow statements. For example, if a number is greater than zero then we want to print “Positive Number” but if it is less than zero then we want to print “Negative Number”. In this case we have two print statements in the program, but only one print statement executes at a time based on the input value. We will see how to write such type of conditions in the java program using control statements.

In this tutorial, we will see four types of control statements that you can use in java programs based on the requirement: In this tutorial we will cover following conditional statements:

a) if statement
b) nested if statement
c) if-else statement
d) if-else-if statement


ashokjaiswal719: No I want programming based on this topic
Answered by varaanana1st
5
when we have two or more statements or programming codes we use if statement but if we have only one statement we use l programming code of else else. no examples idiot!!!!!!!!

ashokjaiswal719: No
ashokjaiswal719: want
ashokjaiswal719: programming based on this question
Similar questions