Computer Science, asked by slata4004gmailcom, 8 months ago

what do you mean by fall through condition?why does it occurs​

Answers

Answered by NamanNandan
6

Answer:

Fall through is a situation in java program takes place when the loop misses out a break statement between the different cases.

Explanation:

Please mark me as Branlist

plaese please please

Answered by SounakGuchhait
5

Answer:

When the variable being switched on is equal to a case, the statements following that case will execute until a break statement is reached. ... When a break statement is reached, the switch terminates, and the flow of control jumps to the next line following the switch statement.

Explanation:

one example is

public class Test {

public static void main(String args[]) {

// char grade = args[0].charAt(0);

char grade = 'C';

switch(grade) {

case 'A' :

System.out.println("Excellent!");

break;

case 'B' :

case 'C' :

System.out.println("Well done");

break;

case 'D' :

System.out.println("You passed");

case 'F' :

System.out.println("Better try again");

break;

default :

System.out.println("Invalid grade");

}

System.out.println("Your grade is " + grade);

}

}

Output

Compile and run the above program using various command line arguments. This will produce the following result −

Well done

Your grade is C

Similar questions