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 toString()..help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "toString()..help" Watch "toString()..help" New topic
Author

toString()..help

kieran pattni
Ranch Hand

Joined: Jan 19, 2004
Posts: 47
hi...anyone help...i type this code out and i get DVD@111f71 instead of
Star Wars...
code below
public class ToStringTest
public static void main(String[]args)
DVD d = new DVD("Star Wars",120);
System.out.println(d.toString());
method from the parent class
public String toString()
{
//new implementation
return(this.title+" "+this.length);
}
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
It works OK with this

perhaps you should copy/paste your code, and the error might be spotted.
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
hey Kieran,
welcome to the ranch, You will get lots of help here, but a wee suggestion, this makes it easier for people to read you code;
use the code button below the add reply button, and place your code between this, then it looks more like code with the indentation.
also, most people might not know what you are doing, so adding most of the code might help others to help you.
Are you trying to change the public void printOut() method to you own toString() method?
Davy
[ February 26, 2004: Message edited by: Davy Kelly ]

How simple does it have to be???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: toString()..help