Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

String.valueOf() and String.copyValueOf()  RSS feed

 
Pin Ting
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all ranchers,
What's the difference between String.valueOf(char[] data) and String.copyValueOf(char[] data)?
Many thanks.
Pin Ting
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I think there is no difference between the two methods. As both the methods return a string representation of Character array which is being passed as a parameter.

Cheers,
Gaya3
-------------------------------------
Prasanna Kumar R.V
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pin Ting,
If the Class Documentation isn't clear about such details, then you could always take a look at the source code, which should be available in a file named src.jar or src.zip in your Java 2 SDK installation.
 
Jason Davies
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the source code for Java 1.4.2, both methods are exactly the same in terms of implementation.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!