String--int互转

A:int -->String

1.String s1 = "" + 100;

2.String s2 = String.valueof(100);

3.(int -- Integer -- String)

 Integer i = new Integer(100);

 String s3 = i.toString();

4.String s4 = Integer.toString(100);

B:String --> int

String s = "100";

1.Integer.valueOf(s);

2.(String -- Integer -- int)

 Integer it = new Integer(s);

 int i1 = it.intValue();

1.int i2 = Integer.parseInt(s);

posted @ 2018-10-04 20:47  AyeeX  阅读(116)  评论(0编辑  收藏  举报