How to write XML file with Java and read it?

Write a Java program to read a string and write it to a text file named “out.txt”.?

  • Please can someone help me in writing the java code as I don't have any clue as to how to write it Please help ASAP please!!!!!!!!!!! Thank you

  • Answer:

    Wont give you the whole snippet,but here's the main part :) try { BufferedWriter out = new BufferedWriter(new FileWriter( "out.txt")); out.write(" Whatever you want to write !"); out.newLine(); out.write(" --------------------------------"); out.close(); } catch (IOException e) { System.out.println("Exception "); // Displays exception if try // failed }

Siddra at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

could you give the full coding please???? and what would the class be as you need to name the java file based on the class. thank you

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.