Joeyman
asked on
Tiny problem with JOptionPane
I am a C++ programmer, and I'm trying to teach myself Java. According to my book, the following code should work:
import java.awt.*;
import javax.swing.*;
public class Test
{
public void main(String[] args)
{
int a=0;
System.out.println(getWord ());
}
public String getWord()
{
return JOptionPane.showInputDialo g(null "Please enter a word.",JOptionPane.QUESTIO N_MESSAGE) ;
}
}
However, I get the following error:
Syntax error on token ""Please enter a word."", ")" expected
I'm sure I'm just overlooking a tiny thing... any help would be appreciated.
import java.awt.*;
import javax.swing.*;
public class Test
{
public void main(String[] args)
{
int a=0;
System.out.println(getWord
}
public String getWord()
{
return JOptionPane.showInputDialo
}
}
However, I get the following error:
Syntax error on token ""Please enter a word."", ")" expected
I'm sure I'm just overlooking a tiny thing... any help would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Right you were... thanks!
:) Glad to help u !.
It's just a normal comma, bracket error so try changing it with the
JOptionPane above on my comment.