I'm a VERY novice programmer and I need a little bit of help with a piece of code I'm working on. As the subject of this message suggests, I am working in JAVA. My first problem is with outputting information to a file. I'm using BufferedWriter and basically the following two lines of code to accomplish this task.
PrintWriter outFile=new PrintWriter(new BufferedWriter(new FileWriter("testout.txt")));
outFile.write("hello");
This code, when run, creates the text file specified, but does not output anything to it. My second question is even simpler: how would I go about having JAVA find out how many lines long an input file it is parsing for information is? All help is appreciated. Thanks in advance.
PrintWriter outFile=new PrintWriter(new BufferedWriter(new FileWriter("testout.txt")));
outFile.write("hello");
This code, when run, creates the text file specified, but does not output anything to it. My second question is even simpler: how would I go about having JAVA find out how many lines long an input file it is parsing for information is? All help is appreciated. Thanks in advance.