How to convert an integer value to string?

前端 未结 5 1739
遥遥无期
遥遥无期 2021-02-14 06:26

How do I convert an integer variable to a string variable in Java?

5条回答
  •  囚心锁ツ
    2021-02-14 07:26

    There are many different type of wat to convert Integer value to string

     // for example i =10
    
      1) String.valueOf(i);//Now it will return "10"  
    
      2 String s=Integer.toString(i);//Now it will return "10" 
    
      3) StringBuilder string = string.append(i).toString();
    
       //i = any integer nuber
    
      4) String string = "" + i; 
    
      5)  StringBuilder string = string.append(i).toString();
    
      6) String million = String.format("%d", 1000000)
    

提交回复
热议问题