File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes object to string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object to string" Watch "object to string" New topic
Author

object to string

kevin schmidt
Ranch Hand

Joined: Aug 24, 2001
Posts: 85
Hi,
I was wondering how a person convert an object to a string. I've tried casting, but it doesn't work. I'm calling a function from a java file that I wrote. It returns a string, but I can't say "String kevin = newName;", it doesn't work. What can I do? TIA.
Kevin
Danny Davies
Greenhorn

Joined: Sep 10, 2001
Posts: 1
Hi,
every class you create is derived from the class Object, the class Object has a method toString(). So therefore once you create an instance of that class you can call the toString() method. Here's an example, hope this helps.

Danny
[This message has been edited by Danny Davies (edited September 10, 2001).]
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
It should work just fine. You may need to provide more detail if it still does not work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object to string