Hi Abigail,
'Error' and 'warning' are two different things. Usually, an 'error' is a fatal flaw that must be fixed. A 'warning' is just that - an advisement that something could be done better, perhaps, but shouldn't impact the compiling of the program. 'Warning' messages are more IDE developer determined. Eclipse is very sophisticated and has those sorts of 'warnings' to help professional developers streamline their code.
And to clarify your comment, by default, Eclipse won't give you an error or warning because "Unnecessary cast or 'instanceof' operation" is set to be ignored. However, you can adjust the error/warning/ignore parameters in Eclipse using the following instructions:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcompiler%2Fref-preferences-errors-warnings.htm
With BlueJ, I don't remember there being any controls for setting error advisements. Which makes sense considering BlueJ's audience. BlueJ is a very basic IDE used for entry level students. The code you provided will still work and for someone who has just been introduced to OOP (the intended audience of BlueJ) introducing unnecessary casting is probably something a teacher doesn't want to have to explain when they are just trying to learn how to print an int.
For the command line, the code works so for the same reason no error condition will be shown.
Cheers!
Chris