Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-07-2005, 12:27 PM   #1 (permalink)
chefsride
Registered User
 
Join Date: Sep 2005
Posts: 1
chefsride is on a distinguished road
Java Newbie

I am fairly new to java and I am trying to get help on how to read in a file. I have a file that has a list of words and each word is on a new line. I want to read each word of the file into an element of an array. If anyone can please help me it would be greatly appreciated.
chefsride is offline   Reply With Quote
Old 09-07-2005, 01:49 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,530
sde is on a distinguished road
i'm a little rusty with java, but here's an example of some code i found with the array logic i added to it:
Code:
ArrayList al = new ArrayList();
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
String line = "";

while((line = br.readLine()) != null) {
  al.add(line);
}
__________________
Mike
sde is offline   Reply With Quote
Old 10-25-2005, 03:30 PM   #3 (permalink)
see-seA
Registered User
 
Join Date: Oct 2005
Posts: 2
see-seA is on a distinguished road
Rather make use of the Scanner class.
see-seA is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Resources Belisarius Java 0 03-28-2005 03:03 PM
Java Developer Position in Kansas City justplaindoug Java 0 10-29-2004 12:52 PM
IBM urges Sun to make Java open source redhead Code Newbie News 0 03-01-2004 11:39 PM


All times are GMT -8. The time now is 01:50 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting