A switch statement accepts arguments of type char, byte, short, int, and String
(starting in Java version 7). It also accepts arguments and expressions of types
enum, Character, Byte, Integer, and Short.
So the answer is correct except b should Integer not integer which doesn’t exist.
A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer
A switch statement accepts arguments of type char, byte, short, int, and String
(starting in Java version 7). It also accepts arguments and expressions of types
enum, Character, Byte, Integer, and Short.
So the answer is correct except b should Integer not integer which doesn’t exist.
Thank you Kevin for pointing this out, as you are the only person I’ve seen do so.
Answer: A, F
This answer is correct AF
(and B)
B is not correct answer – there is no such thing like integer. Integer would be correct answer (case sensitive).
Answer is ABF.
B being Integer not integer.
A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer