标签:ima 优秀 没有 logs jdk eclipse new 2-2 .com
os :windows7 x64
jdk:jdk-8u131-windows-x64
ide:Eclipse Oxygen Release (4.7.0)
code:
package jizuiku3;
public class Demo001 {
public static void main(String[] args) {
int num = 1;//int 没有 tostring方法
Integer i = new Integer(num);//Integer有 tostring方法
String s = i.toString();
System.out.println(s);
//还有一个静态的方法
String s1 =Integer.toString(num);
System.out.println(s1);
}
}
result:
Java优秀,值得学习。
学习资源:API手册+Java源码+清净的心地。
JavaSE8基础 Integer.toString 将int类型转为同面值的String类型
标签:ima 优秀 没有 logs jdk eclipse new 2-2 .com
原文地址:http://www.cnblogs.com/jizuiku/p/7469257.html