FreeKB - if elsif else statements in Java
if elsif else statements in Java

Home > Search


An if else if statement in a Java bean/class has the following structure.

if (comparison) {
  --do something--
  }
else if (comparison) {
  --do something--
  }
else {
  --do something
}

 

For example.

if (foo == 10) {
    System.out.println("foo equals 10");
} 
else if (foo == 20) {
    System.out.println("foo equals 20");
} 
else {
    System.out.println("foo does not equal 10 or 20");
}

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 2d682 in the box below so that we can be sure you are a human.




Comments