Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting answer to pop up in dialog box...

 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing a simple program in which I want the answer to an equation to pop up in a dialog box. All I need to pop up is the value of y. Here is my attempt, and the errors. Any suggestions?
//Brandi Love
//Computer Science I Lab, Section 113
//Socks Problem
public class Socks
{
public static void main(String[] args)
{
int x, y;
x = 5 + 2;

y = x + 1;
JOptionPane.showMessageDialog(null,"value of y: " + y, ", "Sample", JOptionPane.INFORMATION_MESSAGE);

System.exit(0);
}
}



 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like just the wrong number of quote marks. The compiler points to Sample being incorrect, so the error is somewhere right before that. Look at each of your parameters ... see if one jumps out at you as missing a quote. (I'm resisting giving you the actual answer - you'll enjoy it much more if you spot it!)
 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay so I resolved the whole quotes problem I'm still getting an error though, with the pointer pointing to the J in JOptionPane. Any idea why?

[ September 21, 2003: Message edited by: Brandi Love ]
 
Brandi Love
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind, I've got it now (I'm so proud of myself, I'm actually starting to understand this ) Thanks for the assistance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic