Java Coder
How to convert into to String in Java?
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

Hi, How to convert into to String in Java?

Thanks

Advertisement
View Answers

December 21, 2012 at 4:40 PM


Hi,

For this following code can be used:

Integer.toString(i);

Here is the complete example:

class IntegerToString 
{
    public static void main(String[] args) 
    {
        System.out.println("Converting Integer to String");
        Integer i= new Integer(10);
        String s = Integer.toString(i);
        System.out.println(s);


    }
}

See the tutorial Convert an Integer into a String.

Thanks