IF ELSE statement

// jamesprogram.java
class jamesprogram {

	public static void main(String args[]){
		
		int bananas=88;
		
		if (bananas>=100)
			System.out.println("Wow! Lots of bananas");
		else if (bananas>=90)
			System.out.println("More than 90 bananas");
	    else if (bananas>=80)
			System.out.println("More than 80 bananas");
		else
			System.out.println("Bonza");
		
	}
}

Outputs:

More than 80 bananas.

As soon as the if else statement is true, that’s the option that’s taken.

Leave a Reply