English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

public class RevisionQ2
{
public static void main( String args[] )


{
double x, y;
String input;


input = JOptionPane.showInputDialog( null, "Enter value for x:" );
x = Double.parseDouble( input );
y = x*x*x+6x*x+12x+8;

// display answer in message dialog
JOptionPane.showMessageDialog( null,"x*x*x+6x*x+12*x+8"+ y +" for x ="+ x );
}
}

whenever i compile it, i always have this error msg
RevisionQ2.java:15: ';' expected
y = x*x*x+6x*x+12x+8;

any helps on it?
thanks alot!

2006-11-21 00:20:37 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

I think you want this:

y = x*x*x+6*x*x+12*x+8

not this:

y = x*x*x+6x*x+12x+8

2006-11-21 00:23:59 · answer #1 · answered by mchenryeddie 5 · 3 0

Try commenting out the line that does your showMessageDialog and replacing it with something like a System.out.Println.

Something in that line doesn't look right..

If commenting that line out allows you to compile,
then start slowly and add

JOptionPane.showMessageDialog(null,"hello");

and keep building on it like that until you get back to where your code is now.

2006-11-21 00:26:18 · answer #2 · answered by Scooby T 2 · 0 1

Switch statement expects int or char as argument.

2016-05-22 05:40:51 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers