I was trying to write part of a program to read in lines from a text file (in the same directory as the .java and compiled class) and print out those lines. I know a little java, but not much, and I don't have the expertise to figure out what is wrong with this code.
import java.io.*; public class Prog1{ public static void main(String args[]){ try { BufferedReader in = new BufferedReader(new FileReader("testtext.txt")); String line = in.readLine(); in.close(); } catch (FileNotFoundException ex) { Logger.getLogger(Prog1.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Prog1.class.getName()).log(Level.SEVERE, null, ex); } if(line==null){ System.out.println("reading process done"); } else { System.out.println(line); } } }