class Parentl { public String identify() { return "This method is called from Parentl"; Collapse Inheritance- Coding Exercises - Inheritance 3 4 Inheritance Exercise 3 6 class Parent2 { public String 1dentify() { return "This method is called from Parent2": 7. 9 Exercise 3 10 11 12 Create the class Chila such that the following criteria are met 13 //add class definitions below this line 14 15 • Chila is a subclass of Parent1 and Parent2 16 //add class definitions above this line • Override ioentify so that it returns "This method is called from Child" 17 18 • Create the method identifyz that invokes the identify method from Parent2 public class Exercises ( public static void main(String[] args) { 19. 20- • Create the method identify3 that invokes the dentify method from Parenti 21 //add code below this line 22 23 Important Changes will need to be made to the Parenti andlor Parent2 classes. 24 25 //add code above this line Expected Output 26 27 28 The table below shows the expected output for the indicated instantiation. Use the TRY IT button below and verify that your Child object works as expected. First, instantiate a Chila object: //odd code below this Line Child childooject- new Chila(); //add code above this Line Print Statement Output System.out.println(emil@0bject.iøentify()); his method is called from Child System.out.printin(chila0oject.identify2()); This method is called fron Parent2 System.out.printin(chilaooject.identify3()); This method is called from Parenti TRY IT

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Use the given Java code on the left side of the photo:

Codio
Project
File
Edit
Find
View
Tools
Education
Help
Configure.
Virtual Desktop
O Configure.
CMANALILI
Exercise3.java
Inheritance E.
class Parentl {
public String identify() {
return "This method is called from Parentl";
}
}
2
Collapse
Inheritance -> Coding Exercises - Inheritance
3
4
Inheritance Exercise 3
6
7
class Parent2 {
public String identify () {
return "This method is called from Parent2";
}
}
Exercise 3
10
11
12
Create the class Child such that the following criteria are met:
13
//add class definitions below this line
14
15
• Child is a subclass of Parent1 and Parent2
16
• Override identify so that it returns "This method is called from Child"
17
//add class definitions above this line
18
• Create the method identify2 that invokes the identify method from Parent2 .
public class Exercise3 {
public static void main(String[] args) {
19 -
20
• Create the method identify3 that invokes the identify method from Parent1
21
22
//add code below this line
Important, Changes will need to be made to the Parent1 and/or Parent2 classes.
Expected Output
//add code above this line
}
}
The table below shows the expected output for the indicated instantiation. Use the
TRY IT button below and verify that your Child object works as expected.
First, instantiate a Child object:
//add code below this Line
Child childobject = new Child();
//add code above this Line
Print Statement
Output
System.out.println(childObject.identify());
his method is called from Child
This method is called from
System.out.println(childObject.identify2());
Parent2
This method is called from
System.out.println(childobject.identify3());
Parenti
TRY IT
0% (1:0)
Java
Transcribed Image Text:Codio Project File Edit Find View Tools Education Help Configure. Virtual Desktop O Configure. CMANALILI Exercise3.java Inheritance E. class Parentl { public String identify() { return "This method is called from Parentl"; } } 2 Collapse Inheritance -> Coding Exercises - Inheritance 3 4 Inheritance Exercise 3 6 7 class Parent2 { public String identify () { return "This method is called from Parent2"; } } Exercise 3 10 11 12 Create the class Child such that the following criteria are met: 13 //add class definitions below this line 14 15 • Child is a subclass of Parent1 and Parent2 16 • Override identify so that it returns "This method is called from Child" 17 //add class definitions above this line 18 • Create the method identify2 that invokes the identify method from Parent2 . public class Exercise3 { public static void main(String[] args) { 19 - 20 • Create the method identify3 that invokes the identify method from Parent1 21 22 //add code below this line Important, Changes will need to be made to the Parent1 and/or Parent2 classes. Expected Output //add code above this line } } The table below shows the expected output for the indicated instantiation. Use the TRY IT button below and verify that your Child object works as expected. First, instantiate a Child object: //add code below this Line Child childobject = new Child(); //add code above this Line Print Statement Output System.out.println(childObject.identify()); his method is called from Child This method is called from System.out.println(childObject.identify2()); Parent2 This method is called from System.out.println(childobject.identify3()); Parenti TRY IT 0% (1:0) Java
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education