aspose file tools*
The moose likes Beginning Java and the fly likes String.valueOf() and String.copyValueOf() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String.valueOf() and String.copyValueOf()" Watch "String.valueOf() and String.copyValueOf()" New topic
Author

String.valueOf() and String.copyValueOf()

Pin Ting
Greenhorn

Joined: May 28, 2003
Posts: 22
Dear all ranchers,
What's the difference between String.valueOf(char[] data) and String.copyValueOf(char[] data)?
Many thanks.
Pin Ting


Never do things the hard way if you don't have a good reason.
Gayathri Prasad
Ranch Hand

Joined: Jun 25, 2003
Posts: 116
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

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jason Davies
Greenhorn

Joined: Sep 18, 2003
Posts: 14
Looking at the source code for Java 1.4.2, both methods are exactly the same in terms of implementation.


<a href="http://www.netspade.com/" target="_blank" rel="nofollow">http://www.netspade.com/</a> - Web programming articles and tutorials.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String.valueOf() and String.copyValueOf()