Write a segment of code that will use a dialog box to ask a user to enter their age. Their age will then be stored in an int variable named userAge. Assume that the necessary import statements to support the dialog box are already in place.

What will be an ideal response?

```
int userAge;
String ageStr; // used for user's response
ageStr = JOptionPane.showInputDialog("How old are you"?);
userAge = Integer.parseInt(ageStr);
```

Computer Science & Information Technology

You might also like to view...

Automatic spelling and grammar checking is set under the Proofing options after you click Options

Indicate whether the statement is true or false

Computer Science & Information Technology

When working with contacts in any view, you can ____________________ the contacts to display them in a different order.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology