8. If-Elself-Else Statement


#1

public class IfElseIf {
public static void main(String[] args) {

	int round;

	if (round > 12) {

		System.out.println("The match is over!");

	} else if (round < 0) {

		System.out.println("The match is underway!");

	}	else {

		System.out.println("The boxing match hasn't started yet.");

	}	
}

}


#2

Hey @wendybxiong You cant compare an int (primitive type variable) without intalizing it! :smile:

Just initalize it to 6.

Part of Your code(not working):

int round;

Correct Code:

int round = 6;

Hope it helped! If it didnt Please say so! Java is the Best!!!