File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes need read a word of my project . Need help!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need read a word of my project . Need help!!!" Watch "need read a word of my project . Need help!!!" New topic

need read a word of my project . Need help!!!

Oskar Mora

Joined: Jul 17, 2009
Posts: 9
I want to read a file. Txt and we can draw the information it contains. And the important thing to read word for word.
I can read a line but i wanna read word .

1 Hamilton McLaren
2 Kovalainen McLaren
3 Raikkonen Ferrari
4 Massa Ferrari
5 Kubica BMW Sauber
6 Heidfeld BMW Sauber
7 Alonso Renault
8 Piquet Renault
9 Trulli Toyota
10 Glock Toyota
11 Bourdais Toro Rosso
12 Buemi Toro Rosso
13 Webber Red Bull
14 Vettel Red Bull
15 Rosberg Williams
16 Nakajima Williams
17 Button Honda
18 Senna Honda
19 Sutil Force India
20 Fisichella Force India

i wanna read a number and save on a array ........ for use after for make a instance at another text .

1 1 35 37 950
2 1 36 12 42
11 1 37 2 133
16 1 36 43 796
7 1 35 22 453
9 1 36 23 23
15 1 36 24 964
5 1 36 9 692
10 1 36 40 380
4 1 35 32 339
6 1 36 54 567
8 1 37 5 56
(this is a race ) .....
the first number is a driver and the next is the time of a race (and i need order this) .......

thanks ;)

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46352
Welcome to JavaRanch

We don't simply give out answers. You will have to do the work, show us what you have thought of, and let us comment about it.

Don't try to do all those things. Try one at a time. You can read a line: how? When you have a line, how can you divide it into individual "words"? Show us how you think you can do that, and get that working. Then try the sorting later.

Have you been given that file to complete? It looks peculiar. I wouldn't put sorting methods in the same class as a race (I presume Carrera means race).
Oskar Mora

Joined: Jul 17, 2009
Posts: 9
I need extract the information of first date
example i need a number of a driver n'1 .

I can read line at line but i need help for read only the first word.
Only this i don´t need more.
And when i get the word save on a string .
But i dont remember exit on the screen only 1 word.
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

I guess you can try to read the line and use split method (from String class). Then, all you have to do, is to create the String object that you want based on the index of the array returned from the split.
I agree. Here's the link:
subject: need read a word of my project . Need help!!!
It's not a secret anymore!