Check out example codes for "else if java". It will help you in understanding the concepts better.

Code Example 1

if statement executes a set of statements if condition is true.

Syntax:

if(condition)
{
   // if condition is true;
}

Code Example 2

int x = 3;

if (x == 3) {
  // block of code to be executed if the condition is true
} else {
  // block of code to be executed if the condition is false
}

Code Example 3

int a=10;
if(a>5){
// block of code to be executed if the condition in true
}
else{
// block of code to be excuted if the condition in false
}

Code Example 4

if(x == 1 && y == 2){
  println("x = 1 and y = 2");
}

Code Example 5

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
}

Code Example 6

int x = 3;

if (x == 3) {
  // block of code to be executed if the condition is true
}

Learn ReactJs, React Native from akashmittal.com