Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 27th, 2001, 12:56 PM
jonathan_at_school jonathan_at_school is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 jonathan_at_school User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How do I?

i need help programming in school with java
i need to retrieve lines that were written to a file
and show them in a pop up
i have written the text file fine but now i am trying to read it line by line...

any help will be appreciated
Jon at Canby High

Reply With Quote
  #2  
Old February 27th, 2001, 01:11 PM
sturg sturg is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Vancouver, WA
Posts: 49 sturg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Hi Jonathan (at school),

You need to open the file and use the readLine method to read each line... put the following in a try..catch block

Code:
String filename = "somefile.txt";
FileInputStream fin =  new FileInputStream(filename);
DataInputStream myInput = new DataInputStream(fin);
while ((thisLine = myInput.readLine()) != null) {  // while loop begins here
   // inside the loop, you can either out.println(), or append to a string, or do whatever you want with each line
} // while
__________________
--
John Sturgeon <><
johns@senareider.com
http://www.senareider.com/technology.php

Reply With Quote
  #3  
Old February 27th, 2001, 01:21 PM
Sammy Sammy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 Sammy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking john

to use a try catch go to URL u should find it useful

Reply With Quote
  #4  
Old February 27th, 2001, 11:40 PM
Sammy Sammy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 Sammy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation hey john sorry

the actuall address is URL not .com my bad
good luck on your quest, any questions? email me

Reply With Quote
  #5  
Old February 28th, 2001, 01:22 PM
Sammy Sammy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 Sammy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile john i did some research

ok heres what u do i have found out that trycatch.com doesnt exsist anymore so i will tell u how to write the program:

1.) Get a Text book CD
2.) go to chapter7
3.) and read it all
4.)then cut and paste from chapter 11 fig 11.4

Reply With Quote
  #6  
Old February 28th, 2001, 01:32 PM
Sammy Sammy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 Sammy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy more help from sammy

you seem like a kid who is in a class he knows nothing about tell your teacher u need a lot of help

Reply With Quote
  #7  
Old February 28th, 2001, 03:14 PM
Adam the Alien Adam the Alien is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Location: Rainy Oregon
Posts: 1 Adam the Alien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Adam the Alien
Thumbs down Teacher won't help, or we wouldn't be here

Sammy,
The teacher of Canby High's Computer Programming class wanted us to search on the Internet for web pages or forums that could help us. I think he got sick of everybody asking for a lot of help.

Reply With Quote
  #8  
Old March 1st, 2001, 04:10 PM
Sammy Sammy is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 0 Sammy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Oh your teacher said to find out on your own

from my past experiences when a teacher says find out on your own it means he has no clue on how to do it? So i will help! Heres what u do since your cd's broken go to URL and search for a copy of the text book cd you can download. If you can't find one contact me. I should have more time this weekend to help you.

[Edited by Sammy on 03-02-2001 at 11:42 AM]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > how do i...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway