Number Tostring

1
http://www.tutorialspoint.com/java/number_tostring.htm Copyright © tutorialspoint.com JAVA - TOSTRING() METHOD Description: The method is used to get a String object representing the value of the Number Object. If t he met hod t akes a primit ive dat a t ype as an argument , t hen t he St ring object represent ing t he primit ive dat a t ype value is ret urn. If t he met hod t akes t wo argument s, t hen a St ring represent at ion of t he first argument in t he radix specified by the second argument will be returned. Synt ax: All t he variant of t his met hod are given below: String toString() static String toString(int i) Parameters: Here is the detail of parameters: i -- An int for which st ring represent at ion would be ret urned. Return Value: toString(): This ret urns a St ring object represent ing t he value of this Int eger. toString(int i): This returns a String object representing the specified integer. Example: public class Test{ public static void main(String args[]){ Integer x = 5; System.out.println(x.toString()); System.out.println(Integer.toString(12)); } } This produces the following result: 5 12

description

java skills

Transcript of Number Tostring

  • http://www.tutorialspoint.com/java/number_tostring.htm Copyright tutorialspoint.comJAVA - TOSTRING() METHOD

    Description:The method is used to get a String object representing the value of the Number Object.If the method takes a primit ive data type as an argument, then the String object representing theprimit ive data type value is return.If the method takes two arguments, then a String representation of the first argument in the radixspecified by the second argument will be returned.

    Syntax:All the variant of this method are given below:

    String toString()static String toString(int i)

    Parameters:Here is the detail of parameters:

    i -- An int for which string representation would be returned.

    Return Value:toString(): This returns a String object representing the value of this Integer.toString(int i): This returns a String object representing the specified integer.

    Example:public class Test{

    public static void main(String args[]){ Integer x = 5;

    System.out.println(x.toString()); System.out.println(Integer.toString(12)); }}

    This produces the following result:

    512