Java Scrap Book  

Java Scrap Book > Data Type > Integer to String Conversion

Integer to String Conversion

You can convert Integer to String by following ways

  1. Integer.toString(int i )
  2. String.valueOf(int i)
  3. if i is an integer variable then ""+i will convert int i to String


public class IntegerToString{

   public static void  main (String args[ ]){
    System.out.println(" Integer to String Conversion = " + Integer.toString(34));
    System.out.println("Integer to String Conversion = " + String.valueOf(145));
    System.out.println("Integer to String Conversion by concatenating int to empty String " + ""+67);
    }
   }


OutPut
Integer to String Conversion = 34
Integer to String Conversion = 145
Integer to String Conversion by concatenating int to empty String 67


Copyright © 2013-2017

javascrapbook.com is a computer science content service should not be treated as the publisher or speaker of any information provided by another Computer Science content provider.

Contact email: javascrapbook2013@gmail.com