Revise the program in number 8 above to use a try/catch block to handle the IOException.
What will be an ideal response?
```
import java.util.*;
public class GetNumbers2
{
public static void main(String args[])
{
Scanner stdin = new Scanner(System.in);
try
{
System.out.print("Enter the first non-negative number: ");
int firstNumber = stdin.nextInt();
System.out.print("Enter the second non-negative number: ");
int secondNumber = stdin.nextInt();
System.out.println("Your numbers are " + firstNumber + "and " +
secondNumber);
}
catch(InputMismatchException e)
{
System.out.println("Please enter a positive integer.");
}
}
}
```
You might also like to view...
When a file is opened for Append,
(A) data may be read starting at the beginning of the file. (B) data written to the file replaces the data already there. (C) data written to the file are inserted at the beginning of the file. (D) data written to the file are added at the end of the file.
The Windows ________ allows you to capture a full desktop screen, a window, a rectangular portion of a screen, or a free-form shape on the screen
A) File Explorer B) Backstage view C) Snipping Tool D) app switcher
Selecting the right programming language for a project depends on
a. who you have working for you and what they know. b. the final requirements for performance and space used. c. the environment of the finished project. d. all of the above
The major features of a DBMS include data security and integrity, interactive query, data entry and updating, data independence, and data storage management.
Answer the following statement true (T) or false (F)