package cn.success;
/**
* long型转String
* @author: WYC
* @date: 2018/6/6 19:55
*/
public class Test {
public static void main(String[] args) {
long a1 = 12;
String s1 = a1 + ""; // 法1:直接加空串
System.out.println(s1 + 999);
long a2 = 34;
String s2 = String.valueOf(a2); // 法2:String.valueOf()
System.out.println(s2 + 999);
long a3 = 56;
String s3 = Long.toString(a3); // 法3:Long.toString()
System.out.println(s3 + 999);
long a4 = 78;
System.out.println(a4 + 999);
System.out.println(a4 + "abc");
}
}
输出:
12999
34999
56999
1077
78abc