saving . . . saved Why there's an error in the following program which has been written in a similar way as been taught by the professor in the lecture. has been deleted. Why there's an error in the following program which has been written in a similar way as been taught by the professor in the lecture. has been hidden .
Why there's an error in the following program which has been written in a similar way as been taught by the professor in the lecture.
Title
Question
https://drive.google.com/file/d/1pVz5H5AdnYJDrTSI0r-cMt35RCyUOHkk/view?usp=sharing
https://drive.google.com/file/d/1ZL-XFEBM29sJeBqgf28FI28GpcFun3F_/view?usp=sharing

Java Exception-Handling 07-08 min 20-30 sec 23-06-22, 1:18 p.m. sc256356

Answers:

You need to import classes as highlighted in the following code snippet.

import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
public class MarksFile
{
public static void main(String[] args)
{
FileReader fr=null;
try
{
fr=new FileReader("C://Users/Shubhankar/Demo/Gemini.txt");
}
catch (FileNotFoundException e)
{
//TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
System.out.println("Inside finally block");
try
{
fr.close();
}
catch (IOException  e)
{
//TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

23-06-22, 10:57 p.m. pankajap@cse.iitb.ac.in


Log-in to answer to this question.