The mystery of switch statement

Report a typo

Given two initialized variables:

int var1 = 100;
int var2 = 0;

What is the value of var2 after executing the following code?

switch (var1) {            
    case 100:
        var2 += var1;
    case 200:
        var2 += var1 / 4;
    case 300:
        var2 += var1 / 10;
    default:
        var2 = 500;
}
Enter a number
___

Create a free account to access the full topic