Notes on using split method of String object in Java

When using the index to access the array obtained by the split method of String, you need to
check whether there is any content after the last separator , otherwise there is a risk of throwing IndexOutOfBoundsException.

Expansion:
Explanation: For the assignment of Integer var =? Between -128 and 127, the Integer object is generated in IntegerCache.cache and
will reuse the existing object. The Integer value in this range can be directly judged by using ==, but All data outside this range
will be generated on the heap, and existing objects will not be reused. This is a big pit, and it is recommended to use the equals method for judgment.
Any currency amount is stored in the smallest currency unit and integer type.

Guess you like

Origin blog.csdn.net/wangleisuiqiansuiyue/article/details/109192008