Else i f statement

Else if statement is a way of giving many options to java. If statements are not limited to two cases. We can combine else and if to test several number of possibilities. Using if statement we can give one option and else statement helps us to give another option. Else if statement plays a major role where it is required to give many options. For instance, here is a version of the age program.

int age = 55 ;

if(age<60)

System.out.println(“you are a senior citizen”);

else if(age<=50)

System.out.println(“you are not a senior citizen”);

else if(age<=25)

System.out.println(“you are still young”);

Output : you are a senior citizen

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.