Rewrite the following method using try and catch statements instead of the throws clause in the method's header.
public String getInput(String filename) throws IOException
{
BufferedReader infile = new BufferedReader(new FileReader(filename));
String response = infile.readLine( );
infile.close( );
return response;
}
Correct Answer:
Verified
...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q4: The difference between the throw reserved word
Q13: If an exception arises in a catch
Q42: The difference between a scroll pane and
Q44: Write code with a try statement and
Q45: Assume that you will want to save,
Q46: A combo box generates an item event
Q48: Write code that will create a BufferedReader
Q50: Write a save method that will save
Q51: An image (such as a jpg or
Q58: Write a set of code that will
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents