mercredi 8 août 2018

Complete Rookie Confused with "If statment"

Hey I am a complete rookie 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 once again complete noob, Thanks.

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 statment

Aucun commentaire:

Enregistrer un commentaire