那个readLine()返回的是一个字符串吧, 不是int类型.试一试, int i = Integer.parseInt(num);参考:https://zhidao.baidu.com/question/144544532.html