0

When I use %d it displays question mark ? instead of number

import java.util.Scanner;
public class Comparison {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int x;
    int y;
    System.out.println("Value of x");
    x = input.nextInt();
    System.out.println("value of y");
    y = input.nextInt();
    if (x == y)
      System.out.printf("%d=%d%n", x, y);
    if (x != y)
      System.out.printf("%d not equal %d%n", x, y);
    if (x <= y)
      System.out.printf("%d x<=y %d%n", x, y);
  }
}

This is console below

 Value of x
 77
 value of y
 77

 ??=??
 ?? x<=y ??
user85421
  • 28,957
  • 10
  • 64
  • 87

2 Answers2

0

Your code works fine in Intellij.

So code is correct.

Try to update your IDE.

Arty
  • 859
  • 2
  • 12
  • 31
-1

Your code is work good in Eclipse Release 4.7.0 (Oxygen) Last revised June 28, 2017.

So you can view your properties for IDE like -Dfile.encoding=UTF-8