Difference between Long.valueOf(java.lang.String) and new Long(java.lang.String)?
问题 I'm consolidating code written by two different people and notice that casting a String value into a Long has been done in two different ways. Coder #1 has done this: String strId = "12345678"; ... Long lId = new Long(strId); While coder #2 has done this: String strId = "12345678"; ... Long lId = Long.valueOf(strId); Functionally, the code operates exactly the same. There's a try/catch block around each bit to handle any NumberFormatException that is thrown. The incoming string value is an 8