This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: objects given below for the format), used in a previous lecture. First, draw variables p and q on a piece of paper, with value null in them. Then, execute these three assignments, one after the other, evaluating any new-expressions that have to be evaluated and storing the results in the indicated variables. Here is the answer . p= new Animal(); q= new Patient(); p= new Animal(); Solution: There are two variables, p and q, initially containing null. After execution of these assignments: p= new Animal(); q= new Patient(); p= new Animal(); the variables and created objects look like this:...
View Full Document
- Spring '08