Link to home
Start Free TrialLog in
Avatar of Joeyman
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.showInputDialog(null "Please enter a word.",JOptionPane.QUESTION_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.
ASKER CERTIFIED SOLUTION
Avatar of Javatm
Javatm
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> Syntax error on token ""Please enter a word."", ")" expected

      It's just a normal comma, bracket error so try changing it with the
      JOptionPane above on my comment.
Avatar of Joeyman
Joeyman

ASKER

Right you were... thanks!
:) Glad to help u !.