Re: Unable to Overload toString for Object
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[]{bug=
Map});
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 =BBSearch=AB, but the object referred to by
=BBcreateResult=AB is not an instance of the class =BBSearch=AB.
In Java, one cannot modify the toString() method for
the standard class =BBjava.lang.Object=AB as in JavaScript:
Object . prototype . toString = function(){ return "b" }
var test = new Object();
test.toString()
"b"
return String.format("oje"+"abx");
You cannot expect =BBOJEABX=AB when you return =BBojeabx=AB.
Yes now i see the problem. Thanks a lot.
But my problem still remains how do i ACCESS the content of =BBcreateResult=
=AB which is not instance of my class??
Thanks.