• Post Reply Bookmark Topic Watch Topic
  • New Topic

Switch Statement using String on OCA 7

 
Glenn Gould
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!