issue with closing resources. Please advise
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 sc = new Scanner(System.in);
String fname = sc.nextLine();
InputStream inStream = new FileInputStream(fname);
try {
while ( inStream.available() > 0 ) {
int data = inStream.read(); //read one byte from the input stream
System.out.print((char)data);
}
inStream.close(); //close the streams
}
catch(Exception e){
System.out.println(e);
}
finally {
// releases all system resources from the streams
if (inStream != null) {
inStream.close();
}
}
}
}