Java tutorial
import java.io.FileInputStream; public class Main { public static void main(String[] args) throws Exception { System.setIn(new FileInputStream("file.txt")); char ret = (char) System.in.read(); System.out.println(ret); } }