Leave a Reply 7

Your email address will not be published. Required fields are marked *


Kevin

Kevin

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.

Ryan

Ryan

Thank you Kevin for pointing this out, as you are the only person I’ve seen do so.

imyrta

imyrta

Answer: A, F

Lukas

Lukas

This answer is correct AF

Lukas

Lukas

(and B)

simmy

simmy

B is not correct answer – there is no such thing like integer. Integer would be correct answer (case sensitive).

Vishnu

Vishnu

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