can u use else for java name code example
Example 1: else if java
else if statement is used to specify new condition if first condition is false.
Syntax:
if(condition1)
{
// execute if condition1 is true
}
else if (condition2)
{
// execute if condition2 is true
}
else if (condition3)
{
// execute if condition3 is true
}
else
{
// execute if conditions 1, 2 and 3 becomes false
}
Example 2: if statement java
int x = 3;
if (x == 3) {
// block of code to be executed if the condition is true
}