Infinite loop or Codecademy bug ? Help!

Hello all !

I am stuck in the “FizzBuzz” Java exercice. I t seems to me that my code is identical to the one proposed in the “hints”
At first I could not compile it with the instruction “java FizzBuzz” and returned the messag “Error: Could not find or load main class FizzBuzz
Caused by: java.lang.ClassNotFoundException: FizzBuzz”
(wich I find strange because this instruction worked in previous exercises… and this is what is requested in the “task section”)

Using “javac FizzBuzz.java” seem to launch something but nothing prints… as if it was an infinite loop ?
I thought it might take some time to compute a 100 lines (?) and tried with i <=3 instead of i<=100… it doesn’t seem to help
I restarted the sandbox, logged out of codecademy, cleared cokies and cache…

Could you please tell me what is wrong ? It’s been 2 days… i’m stuck :frowning:


my code bellow :

import java.util.ArrayList;
import java.util.Arrays;

class FizzBuzz {
 
    public static void main(String[] args) {
      for (int i = 1; i <= 3; i++) {
        System.out.println(i);
      }
       
    }
}

Thank you guys !

javac <filename> is the command to compile your code.
It appears you are executing the commands in reverse order. You have to compile your code first then execute it with java <filename>

1 Like

hello Mindlindner, Thank you !! problem solved
To Codecademy : please explain this more clearely in the lesson !!
Hint bellow should be "[…] try compiling first […] then run your code again with “java FizzBuzz” "
image

1 Like

Yeah, those instructions appear to be misleading.