In Java int and String conversion
Others
2020-03-25 13:23:42
views: null
int converted to a String
- Use the static method of Integer
- Integer.toString (int num); a null value will throw a NullPointerException
- Use the static method of String
- String.valueOf (int num); return null "null"
- num + ""; produced two string objects, the slowest
String into int
- Interger.parseInt (String str) static method does not produce objects
- Integer.valueOf (String str) .intValue (); generating an object corresponding to a new Interger.valueOf (String str)
Published 46 original articles
·
won praise 0
·
Views 1023
Origin blog.csdn.net/weixin_37680513/article/details/103492626