10. Spinning, won't accept correct code


#1
public class Switch {
    public static void main(String[] args) {
        
        char penaltyKick = 'X';

        switch (penaltyKick) {

            case 'L': System.out.println("Messi shoots to the left and scores!");
                                break; 
            case 'R': System.out.println("Messi shoots to the right and misses the goal!");
                                break;
            case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
                                break;
            default:
                System.out.println("Messi is in position...");
        break;

        }

    }
}

This code runs forever without stopping. Why is this?

#2

I just copy/pasted/ran it and it did not run forever. You might try reloading/refreshing the web page.


#3

i copy and pasted it into Eclipse and it ran fine, but from the website it just runs forever. I've refreshed and reloaded many times as well as set it to one of the preloaded cases and it still just keeps running. Without it stopping, I can't progress further. Any suggestions aside from refreshing which doesn't seem to work?


#4

Under Get Help, there is an "I want to reset this exercise" option. It will reset everything from the exercise you are in when you click it to the end, so don't do it on an earlier exercise.


#5

I get the same thing. It just keeps going? am i doing something wrong?

public class Switch {
public static void main(String[] args) {

    char penaltyKick = 'X';

    switch (penaltyKick) {

        case 'L': System.out.println("Messi shoots to the left and scores!");
                            break; 
        case 'R': System.out.println("Messi shoots to the right and misses the goal!");
                            break;
        case 'C': System.out.println("Messi shoots down the center, but the keeper blocks it!");
                            break;
        default:
            System.out.println("Messi is in position...");
    break;

    }

}

}


#6

change your browser to Google Chrome and the bug disappears.


#7

I have tried firefox, IE and chrome and unable to get past this exercise, even if I change the char penaltyKick to something else or even l,e or C where it would call another statment it would still lock up and continue loading forever.

the only way I managed to get around it is the following :
I logged in on my phone ( Iphone6s ) and running the page in landscape mode as the page is not friendly for mobiles
run the code ( as it was written correctly already )
then change the variable to something else to trigger the completion of the page
then clicked next then went back on to the website.

Hope this helps


#8

Using Chrome worked for me.