Results 1 to 3 of 3
  1. #1
    sfe23's Avatar
    sfe23 is offline Member
    Join Date
    Feb 2009
    Posts
    42
    Rep Power
    0

    Default [SOLVED] Is it possible to have If in a switch case?

    I'm just working with stacks of strings now and was wondering if would be possible to have an if-else statement withing a switch case?

    Thanks :)

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Sure you could have anything in there, but if the code get to big or unwieldy, I'd recommend refactoring it out into a method.

  3. #3
    sfe23's Avatar
    sfe23 is offline Member
    Join Date
    Feb 2009
    Posts
    42
    Rep Power
    0

Similar Threads

  1. String Title case
    By bugger in forum New To Java
    Replies: 6
    Last Post: 01-31-2012, 02:21 PM
  2. Switch Case and Key Events
    By AndrewM16921 in forum New To Java
    Replies: 4
    Last Post: 01-27-2009, 12:20 AM
  3. Case Based Reasoning
    By kbyrne in forum Advanced Java
    Replies: 4
    Last Post: 04-12-2008, 09:51 PM
  4. problem with operator in case
    By jimJohnson in forum New To Java
    Replies: 2
    Last Post: 03-21-2008, 09:22 PM
  5. Can I set a range in case statement?
    By christina in forum New To Java
    Replies: 1
    Last Post: 07-25-2007, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •