Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27499
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Unable to Overload toString for Object |
| Date | 2014-02-13 08:29 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <ldihbl$a77$1@dont-email.me> (permalink) |
| References | (3 earlier) <afa4179b-ea47-4bc4-b9d3-a3a4e7df06bf@googlegroups.com> <0163eae2-3f35-4b96-a292-87a2fe3d3b03@googlegroups.com> <ldgf0i$quu$1@dont-email.me> <ldgg7n$2nk$1@dont-email.me> <cd1085ea-193d-4826-8308-698ba9096f6a@googlegroups.com> |
On 2/12/2014 11:24 PM, Ojesh Dugar wrote:
> [... lots of ugly double-spaced googlegroup grunge ...]
>
> Object[] array = (Object[]) createResult;
> this line itself gives an error.
> Exception in thread "main" java.lang.ClassCastException: java.util.HashMap cannot be cast to [Ljava.lang.Object;
> at XMLRPC.Testing.main(Testing.java:64)
Your original post said the code's output was
bugs=[Ljava.lang.Object;@2ee5e48a
... which is what you'd get if it output "bugs=" and the string
representation of an Object[] array. On closer inspection, though,
I see that there's nothing in the code that could have produced
the "bugs=" part. Conclusion: You misreported the output or you
reported the output of some slightly different piece of code, and
I was wrong to believe that "[Ljava.lang.Object;@2ee5e48a" was the
string representation of `createResult'. Sorry about that -- but
in the future, please make sure your code and your reported output
belong together.
If `createResult' refers to a HashMap (as the exception text
indicates), you can proceed as markspace showed. If it's an array
(in a follow-up you wrote that "two items are returned [...] both
are array of hashes") you'll need to access its individual elements.
--
Eric Sosman
esosman@comcast-dot-net.invalid
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