Как добавить цикл do while, чтобы при обнаружении класса FileNotFoundException мой пользователь был уведомлен о том, что файл не существует, и предоставил моему пользователю возможность ввести другое имя файла?Это то, что я до сих пор.Спасибо
do
{
// Get a file name from the user.
fileName = JOptionPane.showInputDialog("Enter " +
"the name of a file:");
// Attempt to open the file.
try
{
file = new File(fileName);
inputFile = new Scanner(file);
JOptionPane.showMessageDialog(null,
"The file was found.");
}
catch (FileNotFoundException e)
{
JOptionPane.showMessageDialog(null,
"File not found.");
}
///// while(flag+f)
JOptionPane.showMessageDialog(null, "Done.");
System.exit(0);
}
}