fork(28) download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class convertsObjectIntoString
  6. {
  7.  
  8. //Answer for below query
  9. //http://stackoverflow.com/questions/31847080/how-to-convert-any-object-to-string
  10.  
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. Integer integerObject = 5;
  14. String convertedStringObject = integerObject .toString();
  15. System.out.print("String object :" );
  16. System.out.print(convertedStringObject );
  17.  
  18. }
  19. }
Success #stdin #stdout 0.1s 320512KB
stdin
Standard input is empty
stdout
String object :5