Contoh sederhana JOption pada Java

import javax.swing.JOptionPane;
public class JOption{
  public static void main( String[] args ){
    String name = "";
    String npm = "";
    String kelas = "";
    name = JOptionPane.showInputDialog("Please enter your name");
    npm = JOptionPane.showInputDialog("Please enter your npm");
    kelas = JOptionPane.showInputDialog("Please enter your kelas");
    String msg = "Hello " + name + "! " + "Your NPM is " + npm + ", and Your Class is " + kelas + "!";
    JOptionPane.showMessageDialog(null, msg);
  }
}

Output :





Tidak ada komentar:

Diberdayakan oleh Blogger.