• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

text files creation

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to create multiple text files using the class Formatter?

Here is the instructions for this program: "Write a program to create data for testing the (file-matching accounts receivable) program. Use sample account data from blah blah blah. Run the program to create the files trans.txt and oldmast.txt, to be used by your file-matching program."

I've seen in the text where I can create one text file using the class Formatter but can it create more than one within it?

Thanks for the help.
 
Rancher
Posts: 43024
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you'd need to create two Formatter objects. But I assume that the files will contain different content anyway, so it's not like using just one Formatter makes things much easier, right?
 
Joe Fett
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
No, you'd need to create two Formatter objects. But I assume that the files will contain different content anyway, so it's not like using just one Formatter makes things much easier, right?



That makes perfect sense and is what I suspected.

And yes, both text files will have slightly different formats.

Thanks for the help.
 
Joe Fett
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since that question was answered, I'd like to know something else. If I want to write to more than one text file, is the following code a good or not-so-good way to begin?

I guess the better question is should I make a new java class file for each text file I need to write to?

 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic