• Post Reply Bookmark Topic Watch Topic
  • New Topic

method in String and Integer  RSS feed

 
sarah Marsh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

If don't consider it's int or Integer (I know how to convert between them),
When to use
static String valueOf(int i) in String class
and
When to use
String toString()in Integer class?

Thanks a lot!
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the source code to String:



So, one uses the other. I'd use whichever was more convenient


--Tim
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!