Results 1 to 3 of 3
Thread: loading a text file
- 12-23-2008, 06:33 PM #1
Member
- Join Date
- May 2008
- Posts
- 27
- Rep Power
- 0
loading a text file
I am trying to load a text file which would look somthing like
John
Doe
Mr
Each line i am trying to get assigned to a particular variable, so John should be assigned to firstName.
I have started like
Java Code:try { System.out.println("Please enter the name of the student file" ); String fileName = input.next(); in = new BufferedReader(new FileReader(fileName+".txt")); firstName = in.readLine(); }
firstName = in.readLine(1);
lastName = in.readLine(2);
title = in.readLine(3);
- 12-23-2008, 08:27 PM #2
Member
- Join Date
- Dec 2008
- Posts
- 14
- Rep Power
- 0
Maybe you can try with a switch asking for the number of line that its been reading at the moment?
..:: abretumundo.wordpress.com ::..
- 12-24-2008, 01:46 AM #3
Member
- Join Date
- Dec 2008
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Help loading a Binary Tree from file
By ExplosiveWeasel in forum Java 2DReplies: 16Last Post: 12-17-2008, 02:34 AM -
Error loading object from file : C:\Date.jrxml Jass Report
By cecily in forum JDBCReplies: 2Last Post: 12-03-2008, 12:14 PM -
find and replace text from a text file
By gezzel in forum New To JavaReplies: 2Last Post: 09-19-2008, 05:04 PM -
Loading of JSP file failed
By Heather in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 08-06-2007, 02:15 AM
Bookmarks