How do I convert from int to String?

后端 未结 20 2742
不思量自难忘°
不思量自难忘° 2020-11-21 23:40

I\'m working on a project where all conversions from int to String are done like this:

int i = 5;
String strI = \"\" + i;
         


        
20条回答
  •  不思量自难忘°
    2020-11-21 23:59

    It depends on how you want to use your String. This can help:

    String total =  Integer.toString(123) + Double.toString(456.789);
    

提交回复
热议问题