Answers for "java stream write to file"

0

java stream write to file

@Test
public void givenWritingStringToFile_whenUsingPrintWriter_thenCorrect() 
  throws IOException {
    FileWriter fileWriter = new FileWriter(fileName);
    PrintWriter printWriter = new PrintWriter(fileWriter);
    printWriter.print("Some String");
    printWriter.printf("Product name is %s and its price is %d $", "iPhone", 1000);
    printWriter.close();
}
Posted by: Guest on December-29-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language