try{
output.format(\"%d %s %s %.2f%n\", input.nextInt(),
input.next(),input.next(),input.nextDouble());
} catch(FormatterClosedException formatterClosedExcept
add another catch
with Exception
class. That is the parent class.
catch(Exception e){
//your message or
System.out.print(e.getMessage());
}
You can add catch
for every exception
that your code throws and in the end add this catch with this Exception parent class. If your exception
is not caught by any of the catch
then this will caught your exception.
It will catch all exceptions that is raised by your program.