please provide me the java code to write into a file and then I should able to read that info from file

I want to write the following info onto a file that is located in my d drive. Can any body provide me the java code.

CUSTORDR - "13007","","","0.0","C"
ORDERDET - "12002","item1d","1.0","100.0","100.0"
ORDERDET - "11503","item1b","1.0","100.0","100.0"
ORDERDET - "11503","item1b","4.0","100.0","400.0"
SHIPCHRG - "0.0","0"
SALESTAX - "0.0","0.0"

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSr. Software engineerCommented:
zzynxSr. Software engineerCommented:
So that's:

try {
        BufferedWriter out = new BufferedWriter(new FileWriter("d:/dir1/MyFile.txt"));
    } catch (IOException e) {
String s = ...(whatever You need)

//writing to file
FileOutputStream fout = new FileOutputStream("D:\filename");

FileInputStream fin = new FileInputStream("D:\filename");
byte[] contents = new byte(fin.available());;
String s = new String(contents);
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

zzynxSr. Software engineerCommented:
If you want your file exactly to contain the line

  CUSTORDR - "13007","","","0.0","C"

then use

  out.write("CUSTORDR - \"13007\",\"\",\"\",\"0.0\",\"C\"");
zzynxSr. Software engineerCommented:
>> FileOutputStream fout = new FileOutputStream("D:\filename");
won't work, while
      FileOutputStream fout = new FileOutputStream("D:/filename");
      FileOutputStream fout = new FileOutputStream("D:\\filename");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oops, zzynx You're right :)
This question seems to be popular because it's asked more that once.
From which book?

zzynxSr. Software engineerCommented:
Thanks for accepting.

(For the future: If you're not completely satisfied with a comment - that's how I interprete a B-grade - you can always ask for further explanation)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.