Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.JOptionPane;

public class Main {
    public static void main(String[] args) {
        String inputValue = JOptionPane.showInputDialog("Please input a value");

        if (inputValue == null) {
            System.out.println("CANCEL");
        } else if (inputValue.equals("")) {
            System.out.println("OK");
        } else {
            JOptionPane.showMessageDialog(null, inputValue);
        }
    }
}