File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes getting answer to pop up in dialog box... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting answer to pop up in dialog box..." Watch "getting answer to pop up in dialog box..." New topic
Author

getting answer to pop up in dialog box...

Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
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

Joined: Jan 29, 2003
Posts: 8791
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!)


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
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

Joined: Sep 19, 2003
Posts: 133
Nevermind, I've got it now (I'm so proud of myself, I'm actually starting to understand this ) Thanks for the assistance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting answer to pop up in dialog box...
 
Similar Threads
dialogbox ?
Dialog box problems :(
Lattice Paths
Javascript - alert dialog box and text box
Very urg help me