toString() Method in java conversion from all to String

Java Programming Language Number Class in java (Article) Number Class in java (Program)

1224

Program:

 public class WrapperoStringMethodAll {
    public static void main(String[] args){

       Integer x = 15;

       System.out.println(x.toString());
       System.out.println(Integer.toString(12));

       Double d = new Double("3.14");
       System.out.println("d = "+ d.toString() ); // result is d = 3.14
       System.out.println(Double.toString(12.32));

        Float e = new Float("6.14");
        System.out.println("e = "+ e.toString() );  // result is d = 6.14
        // System.out.println(Float.toString("15.32"));
        // no suitable method found for toString(String) 
        
        Byte f = new Byte("6");
        System.out.println("f = "+ f.toString() );   // result is d = 6
        //System.out.println(Byte.toString("8"));
        // no suitable method found for toString(String)


        Long g = new Long("76474");
        System.out.println("g = "+ g.toString() );
        //System.out.println(Long.toString("8321"));
        // no suitable method found for toString(String)

        Boolean h = new Boolean(true);
		Boolean i = new Boolean("false");
	    System.out.println("h = "+ h.toString() );
        System.out.println("i = "+ i.toString() );
        System.out.println(Boolean.toString(false));

        Character j = new Character('t');
        Character k = new Character('f');
        System.out.println("j = "+ j.toString() );
        System.out.println("k = "+ k.toString() );
        System.out.println(Character.toString('b'));
    }
}

Output:

15
12
d = 3.14
12.32
e = 6.14
f = 6
g = 76474
h = true
i = false
false
j = t
k = f
b
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.