integer - Java toString method difference -
this question has answer here:
i enjoy codefights @ moment , @ end of last fight found interesting. code in 2 cases (mine , opponent) said correct. there difference between source code:
return integer.tostring(character.getnumericvalue(ch1) + character.getnumericvalue(ch2));
and one:
return new integer(character.getnumericvalue(ch1)+ character.getnumericvalue(ch2)).tostring();
what key missing?
from javadoc https://docs.oracle.com/javase/7/docs/api/java/lang/integer.html
string tostring()
returns string object representing integer's value.
static string tostring(int i)
returns string object representing specified integer.
Comments
Post a Comment