Exemple

public ObjectDowncast_Example( String str ) {
super();
this .str = str;
}

public Object getString(){
return str;
}

private String str;

public static void main(String[] args){
ObjectDowncast_Example example = new ObjectDowncast_Example("Hello World!"); //$NON-NLS-1$
String str = (String)example.getString();
System.out.println(str);
}

Solution
Modifiez la méthode afin de revenir au type de données réel au lieu de java.lang.Object.
Si la méthode renvoie des objets de types qui ne partagent pas une interface ou une classe commune, créez la nouvelle interface ou classe et encapsulez-y l'objet.

public ObjectDowncast_Solution( String str ) {
super();
this .str = str;
}

public String getString(){
return str;
}

private String str;

public static void main(String[] args){
ObjectDowncast_Solution example = new ObjectDowncast_Solution("Hello World!"); //$NON-NLS-1$
String str = example.getString();
System.out.println(str);
}