wood burning stoves 2.0
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question on Flow Control - Switch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question on Flow Control - Switch " Watch "Question on Flow Control - Switch " New topic

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

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
Vaibhav Chauhan
Ranch Hand

Joined: Aug 16, 2006
Posts: 115
i think answer should be:


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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Question on Flow Control - Switch
jQuery in Action, 3rd edition