This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Associate Certification (OCAJP 7) 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "Switch Statement using String on OCA 7" Watch "Switch Statement using String on OCA 7" New topic
Author

Switch Statement using String on OCA 7

Glenn Gould
Greenhorn

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
Greenhorn

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Switch Statement using String on OCA 7
 
Similar Threads
Do while error, I'm going crazy
How do I remove duplicates from an array?
Refering to another class's instance of a different class, inside a class
switch statement
switch doubt..