posted 24 years ago
hi Rahul!
Answers b and c are correct. The type used in the switch statement must accommodate all of the values in the case statements. For this reason, both b and c are acceptable. There are two considerations that the compiler checks; the variable in the switch statement must be capable of assuming all of the values in the case statements, and it must be convertible to an int. Answer a is incorrect; x cannot be a byte type because the case constants 200 and 300 are not compatible. Answer d is incorrect because switch statements cannot use long values. You would have to have a specific cast: switch((int)x) before the compiler would accept it.