How to convert String to Object? In fact, I want to install
clientSession.setAttribute("username", "abc")
However he shows
java.lang.String given, required java.lang.Object.
Java String - a Object. ( extends .) StringObject
String
Object
Thus, you can get the link Objectthrough the assignment / initialization:
String a = "abc"; Object b = a;
The string extends the object, which means the object. Object o = a;If you really want to get an Object, you can do it as shown below.
Object o = a;
String s = "Hi"; Object a =s;
- . , , , String. , , .