Error with JOptionPane, method showMessageDialog not applicable
I have been following a tutorial on YouTube for Java using Eclipse. Currently I am trying to multiply two doubles and output the result as a double using JOptionPane.showMessageDialog but it is giving me an error. Here is my code: 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); } } and the error: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method showMessageDialog(Component
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.