This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Associate Certification (OCAJP 7/8) and the fly likes Switch Statement using String on OCA 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7/8)
Bookmark "Switch Statement using String on OCA 7" Watch "Switch Statement using String on OCA 7" New topic

Switch Statement using String on OCA 7

Glenn Gould

Joined: Jul 09, 2013
Posts: 5
The following program compiles from the command prompt and uses the String object in the switch statement.

Question : Has anyone that has taken the exam seen the String object used with the switch statement?
Brandon Mikel

Joined: Jun 18, 2013
Posts: 3
Most definitely. I only recall one example (took it yesterday). It was something like:

And then it asked what the output would be. Apologies if I've got any syntax wrong, I just threw that together.

The output in this case would be:
"Not a fish at all"
Due to the case of the string blah, which is all lower-case, while the "Tuna" case has a capital 'T'.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Switch Statement using String on OCA 7
It's not a secret anymore!