Esempio

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 );
}

Soluzione
Cambiare il metodo in modo da restituire il tipo di dati reale invece di java.lang.Object.
Se il metodo restituisce oggetti di tipi che non condividono un'interfaccia comune, creare la nuova interfaccia o la classe ed integrarvi l'oggetto.

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 );
}