.1)Create a class named StaticBinding in Eclipse. Copy and paste the following code to Eclipse.Ensure there is no error when running it. Take a screenshot of the console and explain each line of the output. You need to explain why you get that output in your own words.  the output to this one is : person speaks  person speaks

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

.1)Create a class named StaticBinding in Eclipse. Copy and paste the following code to Eclipse.Ensure there is no error when running it. Take a screenshot of the console and explain each line of the output. You need to explain why you get that output in your own words. 

the output to this one is :

person speaks 

person speaks 

2)Create a class named DynamicBinding in Eclipse. Copy and paste the following code to Eclipse.
Ensure there is no error when running it. Take a screenshot of the console and explain each line
of the output. You need to explain why you get that output in your own words

the output to this one is 

teacher speaks 

person speaks

 
 
 
◆ eclipse-workspace - project2/src/project2/DynamicBinding.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
- 2
C
HA
TestPrintPri...
P
SquareTest.java
project.java
1 package project2;
2 class Person1 {
95.
{
6}
7}
30 public void speak ()
4
5
System.out.println("Person speaks");
#
Difference.java
24 }
25 }
8 class Teacher1 extends Person1 {
9 @Override
10 public void speak ()
11 {
System.out.println("Teacher speaks");
57°F
Mostly cloudy
▼
12
13 }
14 }
15 public class DynamicBinding
160 public static void main(String args[])
17 {
18 // Reference is of Person type and object is Teacher type
19 Personl obj = new Teacher1 ();
20 obj.speak ();
21 //Reference and object both are of Person type.
22 Personl obj2 = new Person1 ();
23 obj2.speak ();
▬▬
■
NO 1
Q Search
Triangle.java
TestTriangl...
Writable
a
P
ArrayList Te...
Smart Insert
Static Bindin...
25:2:498
Static Bindin...
IT
Dynamic Bindi... X
88
a
2
4:23 PM
3/30/2023
X
* * * + @ 隐旦
8
%
鼎
2
@
@
Transcribed Image Text:◆ eclipse-workspace - project2/src/project2/DynamicBinding.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help - 2 C HA TestPrintPri... P SquareTest.java project.java 1 package project2; 2 class Person1 { 95. { 6} 7} 30 public void speak () 4 5 System.out.println("Person speaks"); # Difference.java 24 } 25 } 8 class Teacher1 extends Person1 { 9 @Override 10 public void speak () 11 { System.out.println("Teacher speaks"); 57°F Mostly cloudy ▼ 12 13 } 14 } 15 public class DynamicBinding 160 public static void main(String args[]) 17 { 18 // Reference is of Person type and object is Teacher type 19 Personl obj = new Teacher1 (); 20 obj.speak (); 21 //Reference and object both are of Person type. 22 Personl obj2 = new Person1 (); 23 obj2.speak (); ▬▬ ■ NO 1 Q Search Triangle.java TestTriangl... Writable a P ArrayList Te... Smart Insert Static Bindin... 25:2:498 Static Bindin... IT Dynamic Bindi... X 88 a 2 4:23 PM 3/30/2023 X * * * + @ 隐旦 8 % 鼎 2 @ @
⇒ eclipse-workspace - project2/src/project2/Static Binding.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
- 2
#Ⓒ
Difference.java
TestPrintPri...
project.java
95. 1 package project2;
2
3 class Person {
4 public static void speak ()
5 {
6
7}
8}
9 class Teacher extends Person {
10 public static void speak ()
11 (
System.out.println("Person speaks");
▼
12
13 }
14 }
15 public class StaticBinding {
160 public static void main(String args[])
System.out.println("Teacher speaks");
SquareTest.java
22 Person obj2 = new Person ();
23 obj2.speak ();
24 }
25 }
57°F
Mostly cloudy
17
18 // Reference is of Person type and object is Teacher type
19 Person obj = new Teacher ();
▬▬
■
20 obj.speak ();
21 //Reference and object both are of Person type.
NO 1
Triangle.java
Q Search
TestTriangl...
Writable
a
P
ArrayList Te...
Smart Insert
Static Bindin... X Static Bindin...
24:2:492
IT
Dynamic Bindi...
88
a
X
4:23 PM
3/30/2023
* * * + @ 隐旦
2
Ag
2
凰
@
Transcribed Image Text:⇒ eclipse-workspace - project2/src/project2/Static Binding.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help - 2 #Ⓒ Difference.java TestPrintPri... project.java 95. 1 package project2; 2 3 class Person { 4 public static void speak () 5 { 6 7} 8} 9 class Teacher extends Person { 10 public static void speak () 11 ( System.out.println("Person speaks"); ▼ 12 13 } 14 } 15 public class StaticBinding { 160 public static void main(String args[]) System.out.println("Teacher speaks"); SquareTest.java 22 Person obj2 = new Person (); 23 obj2.speak (); 24 } 25 } 57°F Mostly cloudy 17 18 // Reference is of Person type and object is Teacher type 19 Person obj = new Teacher (); ▬▬ ■ 20 obj.speak (); 21 //Reference and object both are of Person type. NO 1 Triangle.java Q Search TestTriangl... Writable a P ArrayList Te... Smart Insert Static Bindin... X Static Bindin... 24:2:492 IT Dynamic Bindi... 88 a X 4:23 PM 3/30/2023 * * * + @ 隐旦 2 Ag 2 凰 @
Expert Solution
steps

Step by step

Solved in 6 steps with 1 images

Blurred answer
Knowledge Booster
Events
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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