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
Go Back   Code Forums > Application and Web Development > Java
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 09-07-2005, 11:27 AM   #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, 12:49 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
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); }
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 10-25-2005, 02: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


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

vB 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 02:03 PM
Java Developer Position in Kansas City justplaindoug Java 0 10-29-2004 11:52 AM
IBM urges Sun to make Java open source redhead Code Newbie News 0 03-01-2004 10:39 PM
Java Class Basics: Static Methods bdl Java 0 02-29-2004 02:25 PM
What is OOP and Java? srt42 Java 0 04-07-2003 01:21 AM


All times are GMT -8. The time now is 07:22 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle