#1
Not sure if they recently did an update but I can't seem to get a Switch loop to work anymore.

here is the code

import java.util.*;

public class sd
{
    
    public static void main (String[] args)
    {
        
        char group, response;
        Scanner sc = new Scanner(System.in);
        System.out.println("Space");
        do
            {
                System.out.println("[1]");
                System.out.println("[2]");
                System.out.println("[3]");
                System.out.println("[4]");
                
                    response = sc.next() .charAt(0);
                    
                    switch (response)
                    {
                        case '1' : System.out.println("[1]");
                            break;
                        case '2' : System.out.println("[2]");
                            break;
                        case '3' : System.out.println("[3]");
                            break;
                        case '4' : System.out.println("[4] Exit");
                            break;
                        default: System.out.println("no");
                    }
                    while (response != '4'); 
              }
     }           // it keeps saying it expects a while here 
}


but isn't in the book and even old programs wont work now very frustrating
Been in Japan since August, no fucking money left!
#3
I tried to do Java once. Never again. The sight of burns does not attract the ladies.
Quote by Chrisiphone
Oh wow this is a guitar forum!
Quote by JacobTheMe

Karvid is sexy

Quote by KAS1981
Why is it that some folks quote praise from other members in their sig lines?
Its lame.
#6
anything more helpful? it use to work. I hate they way things update like that making almost £100 worth of books worthless
Been in Japan since August, no fucking money left!
#8
Quote by Mad Marius
You put the while inside the while block. It should be after.

Sorry what do you mean? can you code that out for me and i'll try and compile it? that is literally what the book has, minus the print screen stuff
Been in Japan since August, no fucking money left!
#9
****ing programming!!!! it seems so hard and the answer is always so obvious! this is why they all seem to go bald or listen to metal!

Thanks a lot Deluded_reality and Mad Marius!
Been in Japan since August, no fucking money left!
#10
Quote by GaijinFoot
Sorry what do you mean? can you code that out for me and i'll try and compile it? that is literally what the book has, minus the print screen stuff


Man, just move the while(...) one accolade below... where the commented text is right now.
#11
do
{
//Stuff to do here
}
while (/*condition here*/)

OR

while (/*condition/*)
{
//Stuff to do
}
#12
thanks for the help. this heat isn't doing me too well I think *excuse*
Been in Japan since August, no fucking money left!