Question: Java language Write down a java program segment to do the following: Open file file1 for reading which, as an example, has the following contents
Java language
Write down a java program segment to do the following: Open file file1 for reading which, as an example, has the following contents (an integer followed by different file names): 3 f1 f2 f3 f4 f5 f6 Read the first integer from file 1, and store its value in variable n. Open the n^th file (for example, it would be f3 per contents of file1 in the above example) for writing. Write "Bye" in the opened file and properly flush and close it. import java.util.*; import java.io.*; public class prog{public static void main(String []args){
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
