COMPSCI 61B Study Guide - Midterm Guide: Compile Time, Linked List, Lanthanum Hexaboride
Document Summary
Fill out you name, you neighbor"s names and other information in the grid on the solution sheet. Consider the following example of a program that uses inheritance. abstract class pet{ public pet() { system. out. println( pet. pet ); } public void chase (pet p) { System. out. println( pet. chase ); } abstract public void snarl (pet p); class cat extends pet { public cat () { system. out. println( cat. cat ); } public void snarl (pet p) { System. out. println( cat. snarl ); } class dog extends pet { public dog() { this(0); System. out. println( dog. dog(int) ); } public void chase (cat c) { System. out. println( dog. chase ); } public void snarl (pet p) { Cat c = new cat(); public static void main (string [] args) { p2. chase(c); // part b p2. snarl(p1); // part c. Part b-d: what will each of these lines print? (your answers may include: compile time error or runtime exception if appropriate). Remember to write your answer on the separate.