By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.

Help with this code plz

P: 5
Hi When i run this code in JCreator and compile it ir comes up process complete but when i run it I get an exception in main error Why???

import java.io.*;
public class ReadTxtFile
{
public static void main(String args[]) throws Exception
{
BufferedReader br = new BufferedReader(
new FileReader("test.txt"));
String s;
while (br.ready())
{
s=br.readLine();
System.out.println("The content is "+s);
}
}
}
Nov 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: 3
The destination of that code is to read the content of test.txt file.
So, you must make a file test.txt in the same your work directory .

Try it, u can do it...
Nov 25 '06 #2

P: 34
check your
{
}
i see an error with them.
Nov 25 '06 #3

P: 4
alj
yup.. jariamanbarus is right.. its with the test.txt..
Nov 27 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.