Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.* ; import java.io.* ; /* * * Simple program to test FileNotFoundException */ public class ExceptionTester1 { public static void main(String[] args) {

import java.util.* ;
import java.io.* ;
/*
*
* Simple program to test FileNotFoundException
*/
public class ExceptionTester1
{
public static void main(String[] args)
{
//-----------Start below here. To do: approximate lines of code = 6
// Use a try{...}catch(){..} block and open a file "input.txt" (use the File class)
// read in one word from the file (use a Scanner) and print the length of the word
// The file "input.txt" does not exist so you should catch FileNotFoundException and print:
// "File not found"










//-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions.
System.out.println("Expected:File not found") ;
}
}


Please have the expected output on screenshot along with making sure your output code is well formatted!

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

CHUCK import javaioFile import javaioIOException import javautilScanner public class Chuck public static void mainString args throws IOException Scanner s new Scannernew Filechuckdat int numSets snext... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability & Statistics For Engineers & Scientists

Authors: Ronald E. Walpole, Raymond H. Myers, Sharon L. Myers, Keying

7th Edition

9789813131279, 130415294, 9813131276, 978-0130415295

More Books

Students also viewed these Programming questions

Question

Compute P( 2 Answered: 1 week ago

Answered: 1 week ago