Your new FileInputStream("textfile.txt")correct. If this is an exception, it is not in the current directory textfile.txtwhen the program starts. Are you sure that the file name is not in fact testfile.txt(pay attention to s, not x, in the third position).
. , ( , , FWIW). , , : , , FileInputStream, , Reader / java.io ( FileReader). , , , , Reader r = new FileReader("textfile.txt") ( FileReader r = ...).