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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -