-1
String TypedMaxNumber = MaxValue.getText();
if(TypedMaxNumber == "100")
    System.out.println(TypedMaxNumber+" = 100");

I think it is a silly problem, but when I am running to run this program and I type 100 in the text Field it is not going inside the loop. What could be the reason.

raz
  • 482
  • 1
  • 5
  • 17

1 Answers1

1

I am running to run this program and I type 100 in the text Field it is not going inside the loop.

Its

if(TypedMaxNumber.equals("100"))

Since TypedMaxNumber is of type String. equals() check for value equality

SatyaTNV
  • 4,137
  • 3
  • 15
  • 31