在我的代码中,我要求用户输入三个不同的值除以空格。然后,我想将这三个不同的值分配给三个不同的Double变量。
我尝试将此类字符串的第一个字符分配给我的双变量,但我未能成功。
有什么建议么?
谢谢!
这是我正在尝试做的事情:
int decision = message();
String newDimensions;
double newHeight, newWidth, newLength;
if(decision == 1){
newDimensions = JOptionPane.showInputDialog("Please enter the desired amount to be added" +
"\nto each dimension." +
"\nNOTE: First value is for Height, second for Width, third for Length" +
"\nAlso, input information has to have a blank space between each value." +
"\nEXAMPLE: 4 8 9");
newHeight = Double.parseDouble(newDimensions.charAt(0));