Use the following
String inputValue = JOptionPane.showInputDialog("Please input a value");
and pasrse the input if you want any int or any other type
you can also use System.in.read() as follows
import java.io.IOException;
public class MainClass {
public static void main(String[] args) {
int inChar;
System.out.println("Enter a Character:");
try {
inChar = System.in.read();
System.out.print("You entered ");
System.out.println(inChar);
}
catch (IOException e){
System.out.println("Error reading from user");
}
}
}