D:\cs151\chap80>java  Square 
Enter an integer:
Rats
Exception in thread "main" java.lang.NumberFormatException: Rats
        at java.lang.Integer.parseInt(Integer.java:409)
        at java.lang.Integer.parseInt(Integer.java:458)
        at Square .main(NFException.java:18)

D:\cs151\chap80>

A good answer might be:

The user entered Rats which parseInt could not convert to an integer.

Exceptions and Errors

There was nothing wrong with the program. The problem was with the data the user entered, which could not be converted from characters into an int. When parseInt found the problem, it threw a NumberFormatException.

An exception is a problem that occurs when a program is running. Statements can be added to a program so that it catches its exceptions and deals with them. When an exception occurs, the Java virtual machine creates an object (of class Exception) that represents the problem. A program can use this object to recover from the problem.

An error, also, is a problem that occurs when a program is running. An error is represented by an object of class Error. But an error is too severe for a program to handle. The program must stop running.

QUESTION 2:

(Thought question:) Are Error objects and Exception objects related?

Click Here after you have answered the question