I used
long a = 123456789; String b = a+"";
to convert a value long(or int) to Stringor in this perspective consider it as a String. My question is, is it good to do this? Are there any negative consequences?
long
int
String
And is there any difference in using String.valueOf()vs Long.toString()?
String.valueOf()
Long.toString()
thank
This is normal, as the recent JVM is likely to reduce it to:
String b = String.valueOf(a);
, Java, . a null, b = "null" ? NPE? , .
-, - L :
L
Long a = 123456789L;
String.valueOf() Long.toString() long , a (long), Object#toString():
a
Object#toString()
String b = a.toString();
a, , (long), String.valueOf() Long.toString() , , .
Source: https://habr.com/ru/post/1599020/More articles:Using JSON content using LINQ / C # - jsonHow do you export a file from iOS when using the cordova file plugin? - iosUse crawl library in Android Studio - androidMy Ng class is not working - angularjsoverload operator while retaining basic functionality - c ++golang: эффективность индекса массива - goDomain for one2many does not work Odoo - openerpPrevent Windows from opening a dialog to check read permissions - winapiКак я могу эффективно обрабатывать рекурсивную структуру данных с высокой степенью совместного использования? - performanceSupervisord / Celery Output Logs - djangoAll Articles