Question: CSC435 Object Oriented Programming 2. What will happen when you attempt to compile and run the following code? Fix the errors. public class Cat extends

 CSC435 Object Oriented Programming 2. What will happen when you attempt

CSC435 Object Oriented Programming 2. What will happen when you attempt to compile and run the following code? Fix the errors. public class Cat extends Animal protected int tagNumber; public Cat (int tn) { tagNumber = tn; if (haircolor.equals("unknown")) hairColor = "brown"; } public int getTagNumber() { return tagNumber; ) 11 + haircolor + " hair color and tag public String toString() { return "I am a Cat with number " + tagNumber; } class Animal { private String hairColor; public Animal() { hairColor = "unknown"; } public Animal (String hc) { hairColor = hc; } public String getHairColor() { return hairColor; } public String toString() { return "I am an Animal with } + hairColor + " hair color."; CSC435 Object Oriented Programming 2. What will happen when you attempt to compile and run the following code? Fix the errors. public class Cat extends Animal protected int tagNumber; public Cat (int tn) { tagNumber = tn; if (haircolor.equals("unknown")) hairColor = "brown"; } public int getTagNumber() { return tagNumber; ) 11 + haircolor + " hair color and tag public String toString() { return "I am a Cat with number " + tagNumber; } class Animal { private String hairColor; public Animal() { hairColor = "unknown"; } public Animal (String hc) { hairColor = hc; } public String getHairColor() { return hairColor; } public String toString() { return "I am an Animal with } + hairColor + " hair color

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!