Name
JOptionPane Methods Input/Output CS 1
We will be using the JOptionPane methods for input and output. You must import this class so include:
import [Link];
or
import [Link].*;
with every program that uses either statement.
Input: We will use the [Link] to get input from the user. The line that generated the below dialog was:
String firstName = [Link]("Enter your first name please: ");
The information is received as a String. If you wish to convert that information to an integer or a double you need to add:
String sIntInfo = [Link]("Enter an integer: "); int intNum = [Link](sIntInfo);
or
String sDoubleInfo = [Link]("Enter a double: "); double doubleNum = [Link](sDoubleInfo);
Output: We will use the [Link] to output information to the user. The line that generated the below dialog was:
[Link] (null,"Nice to meet you " + firstName + ".");