Reading Input from User Using JOptionPane in Java

0 comments

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 :




Share this article :

Post a Comment

Ads

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Share It Out - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger