Write a short snippet of code that converts the first element of the String[] args array to an integer. It should catch an exception and print out a message if the first element cannot be converted to an integer.
What will be an ideal response?
```
int number;
try {
number = Integer.parseInt(number);
}
catch(NumberFormatException nfe) {
System.out.println("The first argument to the command line"
+ " is not an integer; try again.");
System.exit(0);
}
```
You might also like to view...
A virus can infect a Flash BIOS
Indicate whether the statement is true or false
Explain why the RS232 asynchronous serial interface was probably the worst misfortune to befall early personal computers.
What will be an ideal response?
Grounding ensures that the returning flow of current is properly discharged to the ground. _________________________
Answer the following statement true (T) or false (F)
A tab is a button or area within a group that you click to perform a task.
Answer the following statement true (T) or false (F)