int, double, boolean, char, float, long, object type data converted to String//int type into a string type int h=123456; String l=string.valueof (h); SYSTEM.OUT.PRINTLN ("int type converted to String type:" +l);//double type to stringdouble a=1.1; String a=string.valueof (A); System.out.println ("Double type to String:" +a);//boolean type to String type Boolean b=false; String b=string.valueof (B); System.out.println ("Boolean type to String type:" +b);//char type to String type char d= ' a '; String d=string.valueof (D); System.out.println ("char type to String type:" +d);//char type array converted to string type char[] e={' A ', ' B ', ' C '}; String e=string.valueof (E); System.out.println ("char type array is converted to String type:" +e);//char type array in which several data are converted to string char []f={' a ', ' B ', ' C ', ' d '}; String f=string.valueof (F, 0, 3); System.out.println ("Some of the data in the Char type array is converted to String type:" +f);//float type is converted to string type float g=123; String g=string.valueof (G); System.out.println ("float type is converted to String type:" +g);//long type is converted to string type long j=123342; String j=string.valueof (J); System.out.println ("Long is converted to String type:" +j);//object type is converted to string type Object k=c; String k=string.valueof (K); System.out.println ("ObThe ject type is converted to String type: "+k"; System.out.println ("\ n");//double type to long type double P=88.88;long p=math.round (d); System.out.println ("Double type to Long type:" +p);p =p; Force type Conversion System.out.println ("Double type to Long type:" +p);//float type to long type float Q=123;long q=math.round (q); System.out.println ("Float type to Long type:" +q);
q=q; Force type conversion System.out.println ("Float type to Long type" +q);
Code to run:
The method for converting seven data types, such as int, double, boolean, char, float, long, object, to string data types, is string.valueof ();