import java.io.*; import java.lang.*; import java.util.*; class ReadChar { public static void main(String[] args) { try{ FileReader in = new FileReader(args[0]); BufferedReader data = new BufferedReader(in); char c; int ascii; // read an ascii code and output its char, -1 means the end of file while ((ascii = data.read())!= -1) { c = (char)(ascii); ascii = (int) c; System.out.println("ASCII: " + ascii + "\t" + "char: " + c); } data.close(); in.close(); } // I/O errors catch (IOException e){ System.out.println("Unable to read input file"); } } }