Java Program to convert from integer to String

Java 8Object Oriented ProgrammingProgramming

To convert integer to string, firstly set an integer.

int val = 150;

Now use the Integer.toString() method and pass the same int value. The method returns a string representation.

String myStr = Integer.toString(val);

Let us now see the complete example.


 Live Demo

public class Demo {
   public static void main( String args[] ) {
      int val = 150;
      // integer to string
      String myStr = Integer.toString(val);
      System.out.println("String: "+myStr);


String: 150
Published on 12-Nov-2018 10:32:26