1. Parse () is a SimpleDateFomat method, usually including parseInt() or parsefloat().

As the name suggests, parseInt() converts a String to an int.

Such as

String a= “123”; 

int b = Integer.parseInt(a); \

So b is equal to 123.

 

ValueOf() for example, integer.valueof () converts a String to an Integer (note: an Integer, not an int, which is a simple type for numbers and a complex type for references).

Such as:

String a= "123";
Integer c =Integer.valueOf(a);
// The Integer type can be converted to int using the intValue method
int b =c.intValue();
Copy the code

And then this b is equal to 123

 

3. ToString () converts a reference type toString.

Here’s an example of converting an Integer to a String instead of 2:

Integer a = new Integer(123);
String b =a.toString();
Copy the code

\

So b is going to be 123

\