Reading Input from User Using JOptionPane in Java

In addition to using a BufferedReader like my post before this. Read input from the user can also use the JOptionPane. I am here using JCreator. Simply, in the example script :

------------------------------------------------------------------------------------------------
import javax.swing.*;
public class inputjop {
public static void main(String [] args) {
String input = JOptionPane.showInputDialog("Masukkan nama anda : ");

String nama = "Terimakasih, " + input;
JOptionPane.showMessageDialog(null,nama);
}
}
------------------------------------------------------------------------------------------------


Having completed the above script is typed, press F5, then the output will appear as shown below :




0 komentar:

Posting Komentar