摘要: 题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制。 知识补充:BufferedReader 中read()和readLine() read():方法功能:读取单个字符。返回:作为一个整数 阅读全文
posted @ 2016-09-18 23:19 那一年的我们 阅读(197) 评论(0) 推荐(0)
摘要: Type mismatch: cannot convert from Integer to int 原因:是因为该项目的jdk版本太低,如图所示: 右键项目-》属性》java compiler修改jdk的版本 Exception in thread "main" java.lang.Error: U 阅读全文
posted @ 2016-09-18 09:43 那一年的我们 阅读(430) 评论(0) 推荐(0)
摘要: String 转int s="12345"; int i; 第一种方法:i=Integer.parseInt(s);;//直接使用静态方法,不会产生多余的对象,但会抛出异常 第二种方法:i=Integer.valueOf(s).intValue();//Integer.valueOf(s) 相当于 阅读全文
posted @ 2016-09-18 09:31 那一年的我们 阅读(155) 评论(0) 推荐(0)