Problem:
Write a program that displays text in a message dialog box.
Solution:
The following code gives the solution to the problem:
/* WelcomeInMessageDialogBox.java:
* This application program displays Welcome to Java!
* in a message dialog box.*/
import javax.swing.JOptionPane;
public class WelcomeInMessageDialogBox {
public static void main(String[] args) {
//Display Welcome to Java! in a message dialog box
JOptionPane.showMessageDialog(null, "Welcome to Java!") ,
"Example 1.2 Output", JOptionPane.INFORMATION_MESSAGE);
//Exit the program
System.exit(0);
}
}
Im using netbeans for this, and on the lines JOptionPane.showMessageDialog(null, "Welcome to Java!") , and "Example 1.2 Output", JOptionPane.INFORMATION_MESSAGE);
there is an exclamation point next to both of them. I tried to run the program and to see if the dialog box will appear, but it doesn't work. I don't know what I'm doing wrong. Here's a screenshot of what i am doing currently. im attacting thefile...