Příklad

public class ClassA {
Object o;
String s;
public void methodA() {

s = (String) o;
// ...
}

}
Řešení Ujistěte se, že obejkt o je String
Příklad

public class ClassA {
String s;
Object o;
public void methodA() {

if (o instanceof String){
s = (String) o;
// ...

}

}