Java Data Type How to - Convert Long into String








Question

We would like to know how to convert Long into String.

Answer

public class Main {
  public static void main(String[] args) {
/*from ww w  . jav a 2 s. c  o m*/
    Long lObj = new Long(10);

    String str = lObj.toString();

    System.out.println("Long converted to String as " + str);

  }

}

The code above generates the following result.