+ 1
Urgent help
Dear experts in Java Will someone offer me some basic tasks for the if statements please and thank you đđ»
1 Answer
0
The condition for an if statement is boolean, meaning its either true or false. So you need to come up with a condition, such as if(x < y)
and if this is a true statement then the body will execute.
int x = 2;
int y = 3;
if(x < y)
System.out.print(x + â is less then â + y);
else
System.out.print(y + â is less then â + x);
Try this and play around with the numbers. Notice how it will always say the lesser number is less then the greater number, because if the way the if-else statement is constructed.