I’ve new to java, and i’m having problem with the JOptionPane! This is my code :
package myFirstProgram;
import javax.swing.JOptionPane;
public class GuiApplication {
public static void main(String[] args) {
String name = JOptionPane.showInputDialog("Enter your name");
JOptionPane.showMessageDialog(null, "Hello "+name);
int age = Integer.parseInt(JOptionPane.showInputDialog("Enter your age"));
JOptionPane.showMessageDialog(null,"You are "+age+" years old");
}
}
Can someone tell me how to fix it ?
New contributor
Satos Aurel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
5