Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27484
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2014-02-11 01:06 -0800 |
| References | <705891c8-b170-44c0-866f-48eec7b38c4d@googlegroups.com> <overwriting-20140211095259@ram.dialup.fu-berlin.de> |
| Message-ID | <e34ad319-598a-4872-b90c-64a16d35cdac@googlegroups.com> (permalink) |
| Subject | Re: Unable to Overload toString for Object |
| From | Ojesh Dugar <ojesh.u@gmail.com> |
On Tuesday, February 11, 2014 2:28:22 PM UTC+5:30, Stefan Ram wrote:
> Ojesh Dugar <ojesh.u@gmail.com> writes:
>
> >public class Search {
>
> >public String toString() {
>
> >Object createResult = rpcClient.execute("Bug.search", new Object[]{bugMap});
>
> >System.err.println("createResult =" + createResult.toString());
>
> >Its not returnig OJEABX as expected. Instead bugs=[Ljava.lang.Object;@2ee5e48a being diplayed.
>
> >Where am i going wrong.??
>
>
>
> You attempt to tackle a programming task without having
>
> learned the language fundamentals first. Otherwise, the
>
> error would be obvious to you.
>
>
>
> You are overwriting the toString() method for objects
>
> of the class »Search«, but the object referred to by
>
> »createResult« is not an instance of the class »Search«.
>
>
>
> In Java, one cannot modify the toString() method for
>
> the standard class »java.lang.Object« as in JavaScript:
>
>
>
> Object . prototype . toString = function(){ return "b" }
>
> var test = new Object();
>
> test.toString()
>
> "b"
>
>
>
> >return String.format("oje"+"abx");
>
>
>
> You cannot expect »OJEABX« when you return »ojeabx«.
Yes now i see the problem. Thanks a lot.
But my problem still remains how do i ACCESS the content of »createResult« which is not instance of my class??
Thanks.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-10 22:59 -0800
Re: Unable to Overload toString for Object leif.roar@invalid.com (Leif Roar Moldskred) - 2014-02-11 02:40 -0600
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:03 -0800
Re: Unable to Overload toString for Object Lew <lewbloch@gmail.com> - 2014-02-11 15:49 -0800
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 00:38 -0800
Re: Unable to Overload toString for Object markspace <markspace@nospam.nospam> - 2014-02-12 10:37 -0800
Re: Unable to Overload toString for Object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-02-12 13:57 -0500
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 20:24 -0800
Re: Unable to Overload toString for Object Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-02-13 08:29 -0500
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-12 20:58 -0800
Re: Unable to Overload toString for Object markspace <markspace@nospam.nospam> - 2014-02-12 21:29 -0800
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-13 00:59 -0800
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:06 -0800
Re: Unable to Overload toString for Object Ojesh Dugar <ojesh.u@gmail.com> - 2014-02-11 01:27 -0800
csiph-web