java stream write to file

Solutions on MaxInterview for java stream write to file by the best coders in the world

showing results for - "java stream write to file"
Giada
23 Mar 2019
1@Test
2public void givenWritingStringToFile_whenUsingPrintWriter_thenCorrect() 
3  throws IOException {
4    FileWriter fileWriter = new FileWriter(fileName);
5    PrintWriter printWriter = new PrintWriter(fileWriter);
6    printWriter.print("Some String");
7    printWriter.printf("Product name is %s and its price is %d $", "iPhone", 1000);
8    printWriter.close();
9}