FizzBuzz

Hey Everyone! I’m pretty sure this code should work. I keep getting the following error message.

Error: Could not find or load main class FizzBuzz
Caused by: java.lang.ClassNotFoundException: FizzBuzz

How do I fix that :point_up_2:???

class FizzBuzz {

public static void main(String[] args) {

  for (int i = 1; i <= 100; 1++){
  
  if ((i % 3 == 0) && (i % 5 == 0)){
    System.out.println("FizzBuzz");

  } else if (i % 3 == 0){
    System.out.println("Fizz");
  } else if (i % 5 == 0){
    System.out.println("Buzz");

  } else 
    System.out.println(i);
  }
}
}
1 Like

What command did you enter in the terminal?
It looks to me like you tried to run the program without having compiled it first.

What command did you enter in the terminal?
It looks to me like you tried to run the program without having compiled it first.

Alternatively (not sure where you’re running this): Is the name of the file FizzBuzz.java?

yes it is named FizzBuzz,java

Ha I did it!!! Thanks for your help. I had a ( 1 ) where and ( i ) should have been.

1 Like