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
This note was uploaded on 07/07/2008 for the course CS 101 taught by Professor Gries during the Spring '08 term at Cornell.
- Spring '08