I'm trying to use a string created by JOptionPane in another JOptionPane. I tried making the string global. Am I doing this correctly?
import javax.swing.JOptionPane;
public class Dialogue
{
public static String reason = "";
public static void main(String[] args)
{
ask();
JOptionPane.showInputDialog("You're here because: " + reason);
}
public static void ask()
{
String reason = JOptionPane.showInputDialog("Why are you here?");
}
}