Hi guys
I'm trying to take a user input (name) and replicate the input in other methods. Can anybody help? Here is the code:
import javax.swing.JOptionPane;
public class example
{
public static void main (String[]args)
{
entername();
}
public static void entername()
{
String a="";
a = JOptionPane.showInputDialog("Welcome. Enter name ");
mainscreen();
}
public static void mainscreen()
{
JOptionPane.showMessageDialog(null, "Thankyou " + a); //I want the String a input from entername() to appear here + a
intro();
}
public static void intro()
{
JOptionPane.showMessageDialog(null, "Welldone " + a); //I want the String a input from entername() to appear here + a
}
}
And here are the errors:
C:\Documents and Settings\Adam\My Documents\Uni 2010\ComPuTer SciEncE\Java\example.java:24: cannot find symbol
symbol : variable a
location: class example
JOptionPane.showMessageDialog(null, "Welldone " + a); //I want the String a input from entername() to appear here + a
^
C:\Documents and Settings\Adam\My Documents\Uni 2010\ComPuTer SciEncE\Java\example.java:31: cannot find symbol
symbol : variable a
location: class example
JOptionPane.showMessageDialog(null, "Thankyou " + a); //I want the String a input from entername() to appear here + a
^
2 errors
Process completed.
Thanks guys!