Here you can find the source of writeStringToFile(String stringContent, String fileName)
Parameter | Description |
---|---|
stringContent | the string content |
fileName | the file name |
Parameter | Description |
---|---|
Exception | the exception |
public static void writeStringToFile(String stringContent, String fileName) throws Exception
//package com.java2s; import java.io.PrintWriter; public class Main { /**//from w ww. j a v a 2 s.c o m * ***************************************** * Output string to file * ******************************************. * * @param stringContent the string content * @param fileName the file name * @throws Exception the exception */ public static void writeStringToFile(String stringContent, String fileName) throws Exception { PrintWriter printOut = new PrintWriter("c:\\temp\\" + fileName); printOut.println(stringContent); printOut.close(); } }