Java Text
Files
I have text file text1 & text2. Suppose text1 has value A=10 & text2 has values A=20 & B=30 then how can I see the addition of these two in third file as text3 having values A=30 & B=30. Lets see if my suggestion [pseudo logic] can be of any help to you and would be more appropriate if you can code on your own with this small info. Though each person has its own way of implementing it but you can take a reference from it and code it as per your style. First Step :- Tried to understand how in java you can open / close / read / write the files. Second step is to find out which method you should use to read the content of the file depending upon the format of the file content [In your text file it should be reading it line by line]. Third, there are tokenisers by which you can use to split the data w.r.t a particular case may be a comma separater or whatever depending upon your requirement. Otherwise there are methods where you can read line by line which I believe will suit in your case as per the text file example and followed by a tokeniser. Fourth and Final Imp. Step. Test it.. :-)))) Gaurav
Related:
Java Certification, Programming, JavaBean and Object Oriented Reference Books Return to : Java Programming Hints and Tips All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|