public
static String valueOf(boolean b)
Returns
the string representation of the boolean argument.
class StringValueOfBoolean{ public static void main(String args[]){ boolean var1 = true, var2 = false; String str1 = String.valueOf(var1); String str2 = String.valueOf(var2); System.out.println("str1 = " + str1); System.out.println("str2 = " + str2); } }
Output
str1 = true str2 = false
No comments:
Post a Comment