SlideShare a Scribd company logo
Use the following code fragments for the next 3 questions. Assume that: . student. Empileves,
and Betired are all child classes of Peraen Student, Employee, and Retired are all child classes of
Person All four classes have different implementations of a method called getMoney Person p1 =
new Person( ); int m1 =p1.getMoney(); // statement 1 Person p2 = new Student (. . .) ; int m2 =
p2.getMoney ( ); // statement2 Person p3; if (m2
Solution
Given :-
Person p1 = new Person ( );
int m1 = p1.getMoney ( ); // statement1
Person p2 = new Student ( );
int m2 = p2.getMoney ( ); // statement2
Person p3;
if(m2 < 100000)
{
p3 = new Employee( );
}
else
{
p3 = new Retired( );
}
int m3 = p3.getMoney ( ); // statement3
Question 50 :-
statement1 :-
Person p1 = new Person ( );
int m1 = p1.getMoney ( ); // statement1
The call to getMoney ( ) in statement1 will invoke the method defined in Person class.
Explanation :-
Non-private Non-static overridden method is executed from current object class.
Question 51 :-
statement2 :-
Person p2 = new Student ( );
int m2 = p2.getMoney ( ); //statement2
The call to getMoney ( ) in statement2 will invoke the method defined in Student class.
Explanation :-
Non-private non-static overridden method is executed from current object class.

More Related Content

More from ARORACOCKERY2111

Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdfDescribe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
ARORACOCKERY2111
 
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdfcompare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
ARORACOCKERY2111
 
Carbon dioxide transport Drag each label to the appropriate location.pdf
Carbon dioxide transport  Drag each label to the appropriate location.pdfCarbon dioxide transport  Drag each label to the appropriate location.pdf
Carbon dioxide transport Drag each label to the appropriate location.pdf
ARORACOCKERY2111
 
An important part of electrical engineering is PCB design. One impor.pdf
An important part of electrical engineering is PCB design. One impor.pdfAn important part of electrical engineering is PCB design. One impor.pdf
An important part of electrical engineering is PCB design. One impor.pdf
ARORACOCKERY2111
 
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdfAssume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
ARORACOCKERY2111
 
Alternate Electron acceptors Know what these electron acceptors will.pdf
Alternate Electron acceptors Know what these electron acceptors will.pdfAlternate Electron acceptors Know what these electron acceptors will.pdf
Alternate Electron acceptors Know what these electron acceptors will.pdf
ARORACOCKERY2111
 
A man with blood type A and a woman with blood type B have three chi.pdf
A man with blood type A and a woman with blood type B have three chi.pdfA man with blood type A and a woman with blood type B have three chi.pdf
A man with blood type A and a woman with blood type B have three chi.pdf
ARORACOCKERY2111
 
You have been exposed to each of the 8 microbes below.After a coup.pdf
You have been exposed to each of the 8 microbes below.After a coup.pdfYou have been exposed to each of the 8 microbes below.After a coup.pdf
You have been exposed to each of the 8 microbes below.After a coup.pdf
ARORACOCKERY2111
 
Which of the four levels of measurement is most appropriate for Wei.pdf
Which of the four levels of measurement is most appropriate for Wei.pdfWhich of the four levels of measurement is most appropriate for Wei.pdf
Which of the four levels of measurement is most appropriate for Wei.pdf
ARORACOCKERY2111
 
Which statement below regarding membrane structure and membrane tran.pdf
Which statement below regarding membrane structure and membrane tran.pdfWhich statement below regarding membrane structure and membrane tran.pdf
Which statement below regarding membrane structure and membrane tran.pdf
ARORACOCKERY2111
 
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdfWhy do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
ARORACOCKERY2111
 
Which of the following isare true regarding hex digitsA. Hex dig.pdf
Which of the following isare true regarding hex digitsA. Hex dig.pdfWhich of the following isare true regarding hex digitsA. Hex dig.pdf
Which of the following isare true regarding hex digitsA. Hex dig.pdf
ARORACOCKERY2111
 
which is true of the data shown in the histogramI. The distributi.pdf
which is true of the data shown in the histogramI. The distributi.pdfwhich is true of the data shown in the histogramI. The distributi.pdf
which is true of the data shown in the histogramI. The distributi.pdf
ARORACOCKERY2111
 
what steps can be taken to prevent a core melt down when the tur.pdf
what steps can be taken to prevent a core melt down when the tur.pdfwhat steps can be taken to prevent a core melt down when the tur.pdf
what steps can be taken to prevent a core melt down when the tur.pdf
ARORACOCKERY2111
 
use properties of logarithms to expand the logarithmic expression as.pdf
use properties of logarithms to expand the logarithmic expression as.pdfuse properties of logarithms to expand the logarithmic expression as.pdf
use properties of logarithms to expand the logarithmic expression as.pdf
ARORACOCKERY2111
 
Think about immigrant and refugee groups in your community. What is .pdf
Think about immigrant and refugee groups in your community. What is .pdfThink about immigrant and refugee groups in your community. What is .pdf
Think about immigrant and refugee groups in your community. What is .pdf
ARORACOCKERY2111
 
This is for subject MicrobiologyDifferentiate between physical and.pdf
This is for subject MicrobiologyDifferentiate between physical and.pdfThis is for subject MicrobiologyDifferentiate between physical and.pdf
This is for subject MicrobiologyDifferentiate between physical and.pdf
ARORACOCKERY2111
 
The situation at Good Health Hospital has become a bit overwhelming .pdf
The situation at Good Health Hospital has become a bit overwhelming .pdfThe situation at Good Health Hospital has become a bit overwhelming .pdf
The situation at Good Health Hospital has become a bit overwhelming .pdf
ARORACOCKERY2111
 
The law of large numbers states that as the number of observations .pdf
The law of large numbers states that as the number of  observations .pdfThe law of large numbers states that as the number of  observations .pdf
The law of large numbers states that as the number of observations .pdf
ARORACOCKERY2111
 
The majority of new cancers are due to inherited DNA defects. True Fa.pdf
The majority of new cancers are due to inherited DNA defects. True Fa.pdfThe majority of new cancers are due to inherited DNA defects. True Fa.pdf
The majority of new cancers are due to inherited DNA defects. True Fa.pdf
ARORACOCKERY2111
 

More from ARORACOCKERY2111 (20)

Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdfDescribe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
Describe the purpose for carrying out a DNAase Hypersensitivity assa.pdf
 
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdfcompare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
compare and contrast the morphology of Cestodes, Trematodes, and Nem.pdf
 
Carbon dioxide transport Drag each label to the appropriate location.pdf
Carbon dioxide transport  Drag each label to the appropriate location.pdfCarbon dioxide transport  Drag each label to the appropriate location.pdf
Carbon dioxide transport Drag each label to the appropriate location.pdf
 
An important part of electrical engineering is PCB design. One impor.pdf
An important part of electrical engineering is PCB design. One impor.pdfAn important part of electrical engineering is PCB design. One impor.pdf
An important part of electrical engineering is PCB design. One impor.pdf
 
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdfAssume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
Assume ND=NA=1E+15cm-3, in two different slabs of semiconductor (1 e.pdf
 
Alternate Electron acceptors Know what these electron acceptors will.pdf
Alternate Electron acceptors Know what these electron acceptors will.pdfAlternate Electron acceptors Know what these electron acceptors will.pdf
Alternate Electron acceptors Know what these electron acceptors will.pdf
 
A man with blood type A and a woman with blood type B have three chi.pdf
A man with blood type A and a woman with blood type B have three chi.pdfA man with blood type A and a woman with blood type B have three chi.pdf
A man with blood type A and a woman with blood type B have three chi.pdf
 
You have been exposed to each of the 8 microbes below.After a coup.pdf
You have been exposed to each of the 8 microbes below.After a coup.pdfYou have been exposed to each of the 8 microbes below.After a coup.pdf
You have been exposed to each of the 8 microbes below.After a coup.pdf
 
Which of the four levels of measurement is most appropriate for Wei.pdf
Which of the four levels of measurement is most appropriate for Wei.pdfWhich of the four levels of measurement is most appropriate for Wei.pdf
Which of the four levels of measurement is most appropriate for Wei.pdf
 
Which statement below regarding membrane structure and membrane tran.pdf
Which statement below regarding membrane structure and membrane tran.pdfWhich statement below regarding membrane structure and membrane tran.pdf
Which statement below regarding membrane structure and membrane tran.pdf
 
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdfWhy do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
Why do cyanobacteria possess heterocystsA- Heterocysts shield the.pdf
 
Which of the following isare true regarding hex digitsA. Hex dig.pdf
Which of the following isare true regarding hex digitsA. Hex dig.pdfWhich of the following isare true regarding hex digitsA. Hex dig.pdf
Which of the following isare true regarding hex digitsA. Hex dig.pdf
 
which is true of the data shown in the histogramI. The distributi.pdf
which is true of the data shown in the histogramI. The distributi.pdfwhich is true of the data shown in the histogramI. The distributi.pdf
which is true of the data shown in the histogramI. The distributi.pdf
 
what steps can be taken to prevent a core melt down when the tur.pdf
what steps can be taken to prevent a core melt down when the tur.pdfwhat steps can be taken to prevent a core melt down when the tur.pdf
what steps can be taken to prevent a core melt down when the tur.pdf
 
use properties of logarithms to expand the logarithmic expression as.pdf
use properties of logarithms to expand the logarithmic expression as.pdfuse properties of logarithms to expand the logarithmic expression as.pdf
use properties of logarithms to expand the logarithmic expression as.pdf
 
Think about immigrant and refugee groups in your community. What is .pdf
Think about immigrant and refugee groups in your community. What is .pdfThink about immigrant and refugee groups in your community. What is .pdf
Think about immigrant and refugee groups in your community. What is .pdf
 
This is for subject MicrobiologyDifferentiate between physical and.pdf
This is for subject MicrobiologyDifferentiate between physical and.pdfThis is for subject MicrobiologyDifferentiate between physical and.pdf
This is for subject MicrobiologyDifferentiate between physical and.pdf
 
The situation at Good Health Hospital has become a bit overwhelming .pdf
The situation at Good Health Hospital has become a bit overwhelming .pdfThe situation at Good Health Hospital has become a bit overwhelming .pdf
The situation at Good Health Hospital has become a bit overwhelming .pdf
 
The law of large numbers states that as the number of observations .pdf
The law of large numbers states that as the number of  observations .pdfThe law of large numbers states that as the number of  observations .pdf
The law of large numbers states that as the number of observations .pdf
 
The majority of new cancers are due to inherited DNA defects. True Fa.pdf
The majority of new cancers are due to inherited DNA defects. True Fa.pdfThe majority of new cancers are due to inherited DNA defects. True Fa.pdf
The majority of new cancers are due to inherited DNA defects. True Fa.pdf
 

Recently uploaded

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 

Recently uploaded (20)

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 

Use the following code fragments for the next 3 questions. Assume tha.pdf

  • 1. Use the following code fragments for the next 3 questions. Assume that: . student. Empileves, and Betired are all child classes of Peraen Student, Employee, and Retired are all child classes of Person All four classes have different implementations of a method called getMoney Person p1 = new Person( ); int m1 =p1.getMoney(); // statement 1 Person p2 = new Student (. . .) ; int m2 = p2.getMoney ( ); // statement2 Person p3; if (m2 Solution Given :- Person p1 = new Person ( ); int m1 = p1.getMoney ( ); // statement1 Person p2 = new Student ( ); int m2 = p2.getMoney ( ); // statement2 Person p3; if(m2 < 100000) { p3 = new Employee( ); } else { p3 = new Retired( ); } int m3 = p3.getMoney ( ); // statement3 Question 50 :- statement1 :- Person p1 = new Person ( ); int m1 = p1.getMoney ( ); // statement1 The call to getMoney ( ) in statement1 will invoke the method defined in Person class. Explanation :- Non-private Non-static overridden method is executed from current object class. Question 51 :- statement2 :- Person p2 = new Student ( ); int m2 = p2.getMoney ( ); //statement2 The call to getMoney ( ) in statement2 will invoke the method defined in Student class. Explanation :-
  • 2. Non-private non-static overridden method is executed from current object class.