I know that the String can be converted to a long using Long.parseLong(String) method and Long(String) constructor.
String str="12356";
Long myvar= Long.parseLong(str);
Long myvar2 = new Long(str);
Both of them gives same output. Value of myvar and myvar2 is same. I would like to know which one gives better performance and when to use parseLong
and when to use new Long(String s)
.