Answers for "how to create new fileoutput fileoutputstream in java"

0

write files with FileOutPutStream java

@Test
public void givenWritingStringToFile_whenUsingFileOutputStream_thenCorrect() 
  throws IOException {
    String str = "Hello";
    FileOutputStream outputStream = new FileOutputStream(fileName);
    byte[] strToBytes = str.getBytes();
    outputStream.write(strToBytes);

    outputStream.close();
}
Posted by: Guest on November-28-2021
0

java program using FileOutputStream to create a file on mac

File f = new File("\Users\pavankumar\Desktop\Testing\Java.txt");
f.createNewFile();
Posted by: Guest on October-19-2020

Code answers related to "how to create new fileoutput fileoutputstream in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language