Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education