Hi,
Can you please help me with this task? I implemented the .close() method on all the IO objects but it still doesn't verify. When I run it in IntelliJ the program works, reads the file I input, and prints its content. There is no errors.
Thank you.
package com.codegym.task.task13.task1318;
import java.io.*;
import java.util.Scanner;
/*
Reading a file
*/
public class Solution {
public static void main(String[] args) throws IOException {
// write your code here
Scanner scanner = new Scanner(System.in);
String fileName = scanner.nextLine();
InputStream inputStream = new FileInputStream(fileName);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String c;
while ((c = bufferedReader.readLine()) != null) {
System.out.println(c);
}
scanner.close();
inputStream.close();
bufferedReader.close();
}
}