Derzeit versuche ich, mit JOptionPane.showMessageDialog zwei Doubles zu multiplizieren und das Ergebnis als Double auszugeben, aber es wird mir eine Fehlermeldung angezeigt.
Hier ist mein Code:
Code: Select all
import javax.swing.JOptionPane;
public class Variables {
public static void main(String arg[])
{
double length = 3;
double width = 2;
double area = length*width;
JOptionPane myIO = new JOptionPane();
myIO.showMessageDialog(null, area);
}
}
Code: Select all
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method showMessageDialog(Component, Object) in the type JOptionPane
is not applicable for the arguments (null, double)
at Variables.main(Variables.java:11)
Mobile version