It's not a secret anymore!
The moose likes Beginning Java and the fly likes File I/O - How to do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "File I/O - How to do?" Watch "File I/O - How to do?" New topic

File I/O - How to do?

Chris Mathews
Ranch Hand

Joined: Jan 08, 2001
Posts: 46
I am trying to read from a file and then write to a file.
The input file looks like following :
07200608240190200105,WA07MA34_P2, K
The Output should be :
The total Number of records in the input file : < the total number of records > -- In our case it should be 13
The number of unique values in the first column : This case it should be 6
The number of unique values in the secind column : This case it should be 11
I am cluseless about how to achieve this.Anybody please help me with the idea and/or code.

William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Break it down into smaller tasks. First you need to read in from a file. Than work on what you get. Than write out to a file. Do you know how to read data in from a file? Once you read in from the file my guess is you would want to "tokenize" the strings so that you can work on them. Do you know how to do that?

Please ignore post, I have no idea what I am talking about.
Detlev Beutner
Ranch Hand

Joined: Jul 13, 2001
Posts: 76
The solution is given and discussed at
Please, stop CrossPosting. This is the third entry of the same topic (even if this is a better place as "intermediate" or programmer certification study"...).
I agree. Here's the link:
subject: File I/O - How to do?
It's not a secret anymore!