posted 18 years ago
You can always cast an object to another object that is (directly or indirectly) above it in the object hierarchy. Since Object is the root of the hierarchy, every object can be cast to it. Of course, you lose the ability to use all the features that distinguish it from Object.
As to your second question, that depends on what you're doing with the list. It's good practice to use an interface rather than a concrete class, because that frees you to later simply use something other than ArrayList (e.g. LinkedList), if that is beneficial for some reason (e.g. performance). If you had used the concrete class, you'd need to change all the places where it's passed as parameter.