1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/* Convert Integer object to String object This example shows how a Integer object can be converted into String object. */ public class IntegerToStringExample { public static void main(String[] args) { Integer intObj = new Integer(10); //use toString method of Integer class to conver Integer into String. String str = intObj.toString(); System.out.println("Integer converted to String as " + str); } } /* Output of the program would be Integer converted to String as 10 */ |
Java String valueOf Example
output shown wrong….
only one true will be displayed in the output
the comments are very useful to understand
Object o=new String(“Hello World”); is Not Valid