我想从文本框中检索值并将其转换为整数.我写了下面的代码,但它抛出了一个NumberFormatException.
String nop = no_of_people.getText().toString();
System.out.println(nop);
int nop1 = Integer.parseInt(nop);
System.out.println(nop1);
Run Code Online (Sandbox Code Playgroud)
第一个调用System.out.println打印我的数字,但转换为整数给出一个例外.我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
10255 次 |
| 最近记录: |