本帖最后由 Little_Pea 于 2014-12-14 09:59 编辑
- public class Test1 {
- public static void main(String[] args) {
- int a = 12345;
- String result = Integer.toString(a);
- int length = result.length();
- System.out.println("正整数是 " + length + "位数");
- System.out.print("倒叙打印:");
- for (int i=length;i>0;i--) {
- System.out.print(result.charAt(i-1));
- }
- }
- }
复制代码
|