views:

58

answers:

2

I wrote:

Object result = (Object)client.execute("method",params);

in java client.

Actually, the result should be printed in string format. But I can only output the address of "Object result", how can I get the content?

And I have tried String result = (String)client.execute("method",params);

It says lang.until.Object can not cast to lang.util.String.

As the server is written in Python, I was wondering how can I retrieve String from the method.

A: 

I'm hesitant to post this because it seems rather obvious - forgive me if you've tried this, but how about:

String result = (String)client.execute("method",params);
RichieHindle
of course I tried this. But it says can be be cast to String
A: 

so maybe the object returned is not a string... are you sure that you're returning a string in your python application? I seriously doubt it.

John Doe
I'm not familiar with Python. Like,scored_candidates = map(lambda x:(x[0],x[1],sum(map(lambda y:y[2],x[1]))),candidates.items())what should be the corresponding return type of "scored_candidates "
I figured out those objects in Python are type of dictionary, so what's the corresponding type of Python dictionary in Java?
Use your brain and do at least some research, sighs...
John Doe
I did lots of research... change it to Hashtable and HashMap. None of them works. I am now beginning to change all the code in Python to Java.