Java: Out with the Old, In with the New

后端 未结 30 2142
遥遥无期
遥遥无期 2020-12-22 16:11

Java is nearing version 7. It occurs to me that there must be plenty of textbooks and training manuals kicking around that teach methods based on older versions of Java, whe

30条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-22 16:35

    Converting a number to a String:

    String s = n + "";
    

    In this case I think there has always been a better way of doing this:

    String s = String.valueOf(n);
    

提交回复
热议问题