Casting Objects -- How do they work? : <p>I have a Person class, and Object class is just the Object class of Java. I have a Student class that extends the Person Class as well. Can somebody explain why in these different scenarios I get errors when casting and some work?</p>

<pre><code>Person p = (Person) new Object(); // error
Person p = (Person) new Student(“Steve”, 21, 12345); // works
Object o = new Person(“Steve”, 21); // works
Person p = (Person) o; // works
</code></pre>
