2

I got to code Java for an assignment where am I going wrong with this "if statement" surely if I enter anything but 10 in won't print out Variable information. Picture attached.

import java.util.Scanner;

public class JavaApplication7 {

  public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    int code = 0;
    code = input.nextInt();

    if (code == 10); {
      System.out.println(code);
    }
  }

}

If statement

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ron Jeremy
  • 37
  • 7

1 Answers1

0

Never mind I think I figured it out I was ending my statement to early or something this stuff is not very forgiving. Edit: Just saw snr answered haha thank you.

Ron Jeremy
  • 37
  • 7