JOptionPane Input to int

前端 未结 5 1537
面向向阳花
面向向阳花 2021-01-02 14:31

I am trying to make a JOptionPane get an input and assign it to an int but I am getting some problems with the variable types.

I am trying something like this:

5条回答
  •  粉色の甜心
    2021-01-02 15:08

    String String_firstNumber = JOptionPane.showInputDialog("Input  Semisecond");
    int Int_firstNumber = Integer.parseInt(firstNumber);
    

    Now your Int_firstnumber contains integer value of String_fristNumber.

    hope it helped

提交回复
热议问题