-2

When using an if statement, for instance,

if((isInt(search1.nextToken()) == true) && search1.nextToken() != "x") 

would the result returned by search1.nextToken() have different values? This is all wrapped in a while loop as well, and I'm trying to figure out what would happen.

Esoteric Screen Name
  • 6,082
  • 4
  • 29
  • 38
Xavier
  • 313
  • 2
  • 5
  • 18

1 Answers1

1

Yes, it would have different values. Whenever you do nextToken it would read the next available token. I would suggest to try with a simple java program to understand better.

  • Hmm so for this code im testing to see if the next token is an int.. if i call the search1.nextToken inside of the if statement would it be the original token which is an int – Xavier Feb 12 '14 at 22:43
  • From your code I see that there are two conditions, and each search1.nextToken() expression would get different tokens. – Raghu Kasturi Apr 25 '14 at 20:54