GUI – DialogDemo.java

Check edmodo.com for questions on content.

import javax.swing.JOptionPane;


/* 1.4 example used by DialogDemo.java. */
class DialogViewer1{
   public static void main(String[] args) {
       JOptionPane.showMessageDialog(null, "Hello, World!"); System.exit(0);
    }
}
import javax.swing.JOptionPane;

public class DialogViewer2 {
    public static void main(String[] args) {
    
        String name = JOptionPane.showInputDialog("What is your name?"); 
        System.out.println(name);
        System.exit(0);

    }
 }

Homework: Prepare for more questions including JOptionPane.