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 <>
<
FileReader reader = null; try { reader = new FileReader(""); int ch = reader.read() ; while (ch != -1) { // check for your char here } } catch (FileNotFoundException ex) { // } catch (IOException ex) { // } finally { try { reader.close(); } catch (IOException ex) { // } }