Re: Question: How do I read info into a java application from a

admin

Administrator
Staff member
"shalom cohen" <[email protected]> wrote:>>Hello,>I am new to java and have a question.>Question: How do I read info into a java application from a> file (txt) and through regular args in javac line?>Thanks>Shalom CHi Shalom,Pass the file name as a command line argument. Use the BufferedReader classto read the text file in your program:FileInputStream istream = new FileInputStream(args[0]);BufferedReader reader = new BufferedReader(istream);String line;while((line = reader.readLine()) != null){// whatever you want to do with the text}
 
Back
Top