int, String int i=12345; String s= ""; The first method: s=i+ ""; The second method: S=string.valueof (i); What is the difference between these two methods? Does it work the same? Are they interchangeable under any circumstances? String, int s= "12345"; int i; The first method: I=integer.parseint (s); The second method: I=integer.valueof (s). Intvalue (); What is the difference between these two methods? Does it work the same? Are they interchangeable under any circumstances? The following is the answer:
first method: s=i+" "; //produces two string objects The second method: S=string.valueof (i);//Using static methods of the String class, producing only one object the second method: I=integer.valueof (s). Intvalue (); Integer.valueof (s) is equivalent to new Integer (Integer.parseint (s)) and throws an exception, but produces an object more |
|
String and reshape each other