This site requires JavaScript, please enable it in your browser!
Greenfoot back
someone1
someone1 wrote ...

2015/10/15

Printing a statement to user if FileNotFoundException

someone1 someone1

2015/10/15

#
Ok I have 10 text files and the user specifies the amount of text files that will be processed. My question is if the user enters 11 files to be processed instead of 10, obviously the file not found exception would show, i want to print a message to the user saying "This file could not be loaded " + filename, after they execute the piece of code, how would i do this Thanks
danpost danpost

2015/10/15

#
If the user inputs an invalid value (less than one or greater than ten), do not process any files:
if (inputValue > 10 || inputValue < 1)
{
    System.out.println("Input value invalid");
    return;
}
// process files here
someone1 someone1

2015/10/15

#
I want to process files up to 10 if for example they input 11, and also print a message to the screen for the files that were not processed saying "This file does not exist" + thefilename.
You need to login to post a reply.