|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
to use a try catch go to URL u should find it useful
|
|
#4
|
|||
|
|||
|
the actuall address is URL not .com my bad
good luck on your quest, any questions? email me |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
you seem like a kid who is in a class he knows nothing about tell your teacher u need a lot of help
|
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
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] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > how do i... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|