В настоящее время я пытаюсь умножить два двойных значения и вывести результат как двойной, используя JOptionPane.showMessageDialog , но выдает ошибку.
Вот мой код:
Код: Выделить всё
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);
}
}
Код: Выделить всё
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)
Подробнее здесь: https://stackoverflow.com/questions/168 ... sagedialog