Exception in thread "main" java.lang.RuntimeException 错误!大家帮帮我!谢谢了

来源:百度知道 编辑:UC知道 时间:2024/06/18 12:33:04
我是架设一个游戏!!出现这个错误!!
大家帮我看下!我分不多!只有这么多了!!!

以下是具体:

Exception in thread "main" java.lang.RuntimeException: java.lang.NumberFormatExc
eption: For input string: "200 "
at net.sf.odinms.net.channel.ChannelServer.run(ChannelServer.java:181)
at net.sf.odinms.net.channel.ChannelServer.main(ChannelServer.java:487)
Caused by: java.lang.NumberFormatException: For input string: "200 "
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at net.sf.odinms.net.channel.ChannelServer.run(ChannelServer.java:164)
原代码:

public static void main(String args[]) throws FileNotFoundException, IOException, NotBoundException,
InstanceAlreadyExistsException, MBeanRegistrationException,
NotCompliantMBeanException, Malfor

NumberFormatException: For input string: "200 "

明显是对200转换时出现错误,因为你的200后面多了个空格
可以使用String的trim()方法来过滤空格

java.lang.NumberFormatException: For input string: "200 "

我看到字符串后面有一个空格哦

这样是不能转化为字符串的!