Convert boolean, char, double, float,int,long,object to String

ReturnMethodSummary
static StringvalueOf(boolean b)Returns the string representation of the boolean argument.
static StringvalueOf(char c)Returns the string representation of the char argument.
static StringvalueOf(char[] data)Returns the string representation of the char array argument.
static StringvalueOf(char[] data, int offset, int count)Returns the string representation of a specific subarray of the char array argument.
static StringvalueOf(double d)Returns the string representation of the double argument.
static StringvalueOf(float f)Returns the string representation of the float argument.
static StringvalueOf(int i)Returns the string representation of the int argument.
static StringvalueOf(long l)Returns the string representation of the long argument.
static StringvalueOf(Object obj)Returns the string representation of the Object argument.

public class Main {
  public static void main(String[] argv) {
    String str = String.valueOf(123);

    System.out.println(str);
  }
}

The output:


123
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.