- Section C Choose The Correct Answers 1 X 2 2 4 Program To Create A File Using File Writer In Blue J Str Si Impo 1 (39.3 KiB) Viewed 74 times
Section-C (Choose the correct Answers) (1 x 2 = 2 4. Program to create a file using file writer in Blue-J. [str, si impo
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Section-C (Choose the correct Answers) (1 x 2 = 2 4. Program to create a file using file writer in Blue-J. [str, si impo
Section-C (Choose the correct Answers) (1 x 2 = 2 4. Program to create a file using file writer in Blue-J. [str, si import java.io.FileWriter; import java.io. [OlException, IOException] public class CreateFile { public static void main(String[] args) throws IOException { // Accept a string String = "File Handling in Java using "+" File Writer and FileReader"; // attach a file to File Writer File Writer fw= FileWriter("output.txt"); [old, new] // read character wise from string and write // into FileWriter for (int i = 0; i < str.length(); i++) fw.write(str.charAt(i)); System.out.println("Writing successful"); //close the file fw. LO; [open, close] } }