WEB DEVELOPER SITE
PHP7
 

Java - toString() Method


Returns a String object representing the value of a specified int or Integer.


IF the method takes a primitive data type as an argument, then the String object representing the primitive data type value is returned.

Syntax

Following are all the variants of this method โˆ’

String toString()
static String toString(int i)

Parameters

Here is the detail of parameters โˆ’

  • i โˆ’ An int for which string representation would be returned.

Example

public class Test { 

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

      System.out.println(x.toString());  
      System.out.println(Integer.toString(55)); 
   }
}
Run example ยป