如何将String
对象转换为Boolean
对象。
例
在这个例子中,我们将看到String
到Boolean
对象转换的两种方法。
输出:
public static Boolean valueOf(String s)
:返回一个布尔值,其值由指定的字符串表示。返回的布尔值表示如果字符串参数不为null
且与字符串"true"
相等(忽略大小写),则返回true
值。
如何将String
对象转换为Boolean
对象。
例
在这个例子中,我们将看到String
到Boolean
对象转换的两种方法。
输出:
public static Boolean valueOf(String s)
:返回一个布尔值,其值由指定的字符串表示。返回的布尔值表示如果字符串参数不为null
且与字符串"true"
相等(忽略大小写),则返回true
值。