FreeKB - if elsif else statements
Java Programming - if elsif else statements

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 a017b in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |