Sorry, I don't get you.
String o = lst;
I'm afraid that's not possible.
lst is a
List object. So it cannot be assigned to a String reference variable. It will result in a compiler error. Object is the super-type of all types in
Java, so it can be assigned to a Object reference variable.
May be I have mis-understood your reply. Can you please explain ?
P.S. :
As I have stated, the code I have posted is not exactly where I faced this problem. It's a simplified version of it. I faced this issue when I was retrieving an attribute from a
Request object in a
Servlet.
request.getAttribute() always returns the object as an
Object.