If I am scanning from a text
Scanner s= new Scanner("texto.txt");
// I want to compare the next char from the line with a <
// like this:
if(s.nextChar().equals("<")){
.....
I know that s.nextChar()
does not exist but there is any similar thing to use in this case?
Best Answer
Your code would something like...
Note that after the call of
s.nextChar()
, the value is actually fetched, so its better to keep the variable, if you would like to use it further, like: