How to Convert Wrapper Objects to Strings in Java


In this example we will show the method to convert wrapper objects to strings.

Source Code

package com.beginner.examples;

public class Int2String { 
  public static void main(String[] args) { 
    Integer a = 57;
    String str = a.toString(); // convert to strings
    System.out.println(str.length());
  }
}

Output:

2
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments