This website is for reference purposes only. Users are responsible for any misuse. The owner is not liable for any consequences.

Question

Solution

JAVA

package q39954;
import java.io.*;
import java.util.Scanner;

public class FileReaderExample {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String fileName = sc.nextLine();

		try {
			BufferedReader reader = new BufferedReader(new FileReader(fileName));
			String line;
			while((line = reader.readLine()) != null) {
				System.out.println(line);
			}
			reader.close();
		} catch (IOException e) {
			System.out.println("File not found");
		}
		sc.close();
	}
	
}

2/2 test cases passed

3/3 hidden test cases passed