Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following two classes, and the following segment of code in a driver: What is the output of this segment of driver code? Assume
Given the following two classes,
and the following segment of code in a driver:
What is the output of this segment of driver code? Assume relevant code is assembly properly in a project.
System.out.println(oneitem);
oneitem.p1();
oneitem.p2();
System.out.println(onebook);
onebook.p1();
onebook.p2();
public class Item { public void p1() { System.out.print("property 1"); public void p2() { System.out.print("property 2"); public String toString() { return "item info"; public class Book extends Item { public void p1() { super.p1(); System.out.print(" of book"); // there is a space before "of" Item oneitem = new Item(); Book onebook = new Book()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started