用java将String类型转换为int 带有负号的怎么处理。。请大神指教。

看看怎么改啊、谢谢!

第1个回答  2019-03-21
public class Test {
public static void main(String[] args) {
String str = "-123";
int num = Integer.parseInt(str);
System.out.println(num);
}
}

本回答被网友采纳
相似回答