What is the difference between
Object foo = \"something\"; String bar = String.valueOf(foo);
and
Object foo = \"something\"
Both generates same output in case of String.
String
Casting fails in case of provided object is Not a string.
Casting
string.