Results 1 to 3 of 3
  1. #1
    Shesaid is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default Help with while loop inside a switch case

    Is it even possible to do a while loop inside a switch case?

    E.g.:

    Java Code:
    case 'k':
            
            while (readNumber != 0) {
                System.out.print("Test");
                readNumber = In.nextInt(); 
    
    if(this is true)
    { method(readNumber); }
    
    else
    
    {
    some other method();
    }

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,460
    Rep Power
    6

    Default

    Yes. If you need a better answer then provide more details.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,918
    Rep Power
    16

    Default

    I see you removed your previous question.
    Help w/2 things - Character.toLowerCase & do while loop with Switch Statement

    You don't deserve help on a forum.

    db

Similar Threads

  1. Converting if to Switch Case.
    By king2be98 in forum New To Java
    Replies: 5
    Last Post: 02-20-2011, 03:46 PM
  2. Replies: 4
    Last Post: 02-13-2011, 12:03 PM
  3. if else changes to switch-case?
    By noobinoo in forum New To Java
    Replies: 1
    Last Post: 04-23-2010, 05:56 PM
  4. Loop inside a switch
    By mustachMan in forum New To Java
    Replies: 3
    Last Post: 02-26-2010, 03:25 AM
  5. Switch Case and Key Events
    By AndrewM16921 in forum New To Java
    Replies: 4
    Last Post: 01-26-2009, 11:20 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
  •