| Author |
Question on Flow Control - Switch
|
Venkat Sidh
Ranch Hand
Joined: Sep 30, 2006
Posts: 61
|
|
Which of the following types cannot be used as argument to the switch-case statement? Choice - A) float Choice - B) int Choice - C) char Choice - D) long Choice - E) enum Choice - F) short Choice - G) double Choice - H) Integer
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
|
JLS - 14.11 The switch Statement.
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Vaibhav Chauhan
Ranch Hand
Joined: Aug 16, 2006
Posts: 115
|
|
i think answer should be: float,long,double. Reason: all the data types that can be implicitly converted to int can be used for switch case. Integer is right answer only for java 5 because it allows autoboxing/unboxing. Please correct me if i am wrong
|
 |
Venkat Sidh
Ranch Hand
Joined: Sep 30, 2006
Posts: 61
|
|
|
You can't use Integer (Wrapper) in statement as a argument.
|
 |
 |
|
|
subject: Question on Flow Control - Switch
|
|
|