Use of valueof method in java

 public static String valueOf(boolean b) returns the string representation of the boolean parameter.
public static String valueOf(char c) returns the string representation of the char parameter.
public static String valueOf(int i) returns the string representation of the int parameter.
public static String valueOf(long l) returns the string representation of the long parameter.
public static String valueOf(float f) returns the string representation of the float parameter.
public static String valueOf(double d) returns the string representation of the double parameter.
public static Boolean valueOf(boolean b) returns a Boolean instance representing the specified boolean value. This method returns Boolean.TRUE if the specified boolean value is true, or Boolean.FALSE if it is false.
public static Boolean valueOf(String s) returns a Boolean value represented by the specified String. If the String parameter is not null and equals "true" when case is ignored, the returned Boolean represents a true value.
Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false.

public static Integer valueOf(String s)
                       throws NumberFormatException Returns an Integer object that holds the value of the specified String.
public static Integer valueOf(int i) returns an Integer instance representing the specified int value,

which is the conversion between types.

Guess you like

Origin blog.csdn.net/u012598200/article/details/22850763
Recommended