Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21720

Reading a File

X-Received by 10.68.224.130 with SMTP id rc2mr1425368pbc.2.1359176287207; Fri, 25 Jan 2013 20:58:07 -0800 (PST)
MIME-Version 1.0
X-Received by 10.50.85.232 with SMTP id k8mt593986igz.15.1359176287100; Fri, 25 Jan 2013 20:58:07 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!usenet.stanford.edu!ld4no4124432pbb.0!news-out.google.com!s9ni18168pbb.0!nntp.google.com!ld4no4124428pbb.0!postnews.google.com!vb8g2000pbb.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Fri, 25 Jan 2013 20:58:06 -0800 (PST)
Complaints-To groups-abuse@google.com
Injection-Info vb8g2000pbb.googlegroups.com; posting-host=122.161.151.12; posting-account=6SonuQoAAACzSakS5dCECcJQe6ylLrzY
NNTP-Posting-Host 122.161.151.12
User-Agent G2/1.0
X-HTTP-UserAgent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0,gzip(gfe)
Message-ID <4c68b43b-ee08-48fc-91fe-7f3f81213f69@vb8g2000pbb.googlegroups.com> (permalink)
Subject Reading a File
From Subhabrata <subhabangalore@gmail.com>
Injection-Date Sat, 26 Jan 2013 04:58:07 +0000
Content-Type text/plain; charset=ISO-8859-1
Lines 32
Xref csiph.com comp.lang.java.programmer:21720

Show key headers only | View raw


Dear Group,

I am a new learner in Java. And I wanted to open a file and read its
content.
The standard tutorials give long code. They use try,catch etc. I
wanted something simple and started to experiment something as
follows. But it was giving some error.

import java.io.*;
public class FileOutput  {

	/**
	 * @param args
	 */
	public static void main(String[] args)  {
		FileInputStream fstream = new FileInputStream("C:\\FileIO\
\javadict.txt");
		DataInputStream in = new DataInputStream(fstream);
		BufferedReader br = new BufferedReader(new InputStreamReader(in));
		String strLine;
		System.out.println(br.strLine);
	  }

		// TODO Auto-generated method stub

	}

If any one in the room can kindly suggest.

Regards,
Subhabrata.
NB: Thank you all for your earlier solution though I worked my own
with .equals only.

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Reading a File Subhabrata <subhabangalore@gmail.com> - 2013-01-25 20:58 -0800
  Re: Reading a File Knute Johnson <nospam@knutejohnson.com> - 2013-01-25 21:33 -0800
    Re: Reading a File subhabangalore@gmail.com - 2013-01-25 21:53 -0800
      Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-25 22:48 -0800
        Re: Reading a File Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-26 08:01 -0400
          Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-26 10:12 -0800
          Re: Reading a File Knute Johnson <nospam@knutejohnson.com> - 2013-01-26 11:41 -0800
            Re: Reading a File Lew <lewbloch@gmail.com> - 2013-01-26 13:01 -0800
  Re: Reading a File Roedy Green <see_website@mindprod.com.invalid> - 2013-01-26 02:47 -0800

csiph-web