SlideShare a Scribd company logo
1 of 1
Download to read offline
ClassF{
}
Class A{
public void great(Object o){
System.out.print("yeah");
}
}
Class B extends A{
public void great(Object o){
System.out.print("ha");
}
public void great(F o){
System.out.print("ha");
}
}
public class testing{
public static void main(String[] arg){
F f1=new F();
B b1=new B();
B.great(f1);
}
}
Question:
Why here overloading takes precedent than Overriding?
and print "ha",
since f is also an object, why doesn't it goes it the first great(object o)
I think both of the great in class B works.
Can you explain?

More Related Content

More from aghsports

Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdfCisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
aghsports
 
Cinematix se vuelve mvil Cinematix Cinema ha revisado reci.pdf
Cinematix se vuelve mvil  Cinematix Cinema ha revisado reci.pdfCinematix se vuelve mvil  Cinematix Cinema ha revisado reci.pdf
Cinematix se vuelve mvil Cinematix Cinema ha revisado reci.pdf
aghsports
 
Choose one of these three options A IPC using FIFO B Shar.pdf
Choose one of these three options A IPC using FIFO B Shar.pdfChoose one of these three options A IPC using FIFO B Shar.pdf
Choose one of these three options A IPC using FIFO B Shar.pdf
aghsports
 
Chinas Great FirewallChina has a population of over 14 bil.pdf
Chinas Great FirewallChina has a population of over 14 bil.pdfChinas Great FirewallChina has a population of over 14 bil.pdf
Chinas Great FirewallChina has a population of over 14 bil.pdf
aghsports
 

More from aghsports (20)

Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdfCisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
Cisconun Tedarik Zinciri Cisconun tedarik zinciri d kayna.pdf
 
CISC 341 Computer Architecture You must show your work to.pdf
CISC 341 Computer Architecture  You must show your work to.pdfCISC 341 Computer Architecture  You must show your work to.pdf
CISC 341 Computer Architecture You must show your work to.pdf
 
Cinematix se vuelve mvil Cinematix Cinema ha revisado reci.pdf
Cinematix se vuelve mvil  Cinematix Cinema ha revisado reci.pdfCinematix se vuelve mvil  Cinematix Cinema ha revisado reci.pdf
Cinematix se vuelve mvil Cinematix Cinema ha revisado reci.pdf
 
CIGS thinfilm solar modules are potentially competitive wit.pdf
CIGS thinfilm solar modules are potentially competitive wit.pdfCIGS thinfilm solar modules are potentially competitive wit.pdf
CIGS thinfilm solar modules are potentially competitive wit.pdf
 
Choose the correct statement below A Estimators do not gen.pdf
Choose the correct statement below A Estimators do not gen.pdfChoose the correct statement below A Estimators do not gen.pdf
Choose the correct statement below A Estimators do not gen.pdf
 
Choose the correct word to complete these descriptions of st.pdf
Choose the correct word to complete these descriptions of st.pdfChoose the correct word to complete these descriptions of st.pdf
Choose the correct word to complete these descriptions of st.pdf
 
Choose one of these three options A IPC using FIFO B Shar.pdf
Choose one of these three options A IPC using FIFO B Shar.pdfChoose one of these three options A IPC using FIFO B Shar.pdf
Choose one of these three options A IPC using FIFO B Shar.pdf
 
CHOOSE ONLY ONE OF THE FOLLOWING 7 marks 1 Describe in .pdf
CHOOSE ONLY ONE OF THE FOLLOWING 7 marks 1 Describe in .pdfCHOOSE ONLY ONE OF THE FOLLOWING 7 marks 1 Describe in .pdf
CHOOSE ONLY ONE OF THE FOLLOWING 7 marks 1 Describe in .pdf
 
Choose the correct answer 1 The method _ is called by the .pdf
Choose the correct answer 1 The method _ is called by the .pdfChoose the correct answer 1 The method _ is called by the .pdf
Choose the correct answer 1 The method _ is called by the .pdf
 
Choose your own project idea or select one of the following.pdf
Choose your own project idea or select one of the following.pdfChoose your own project idea or select one of the following.pdf
Choose your own project idea or select one of the following.pdf
 
choose the correct answer 1 Water will flow into the beaker.pdf
choose the correct answer 1 Water will flow into the beaker.pdfchoose the correct answer 1 Water will flow into the beaker.pdf
choose the correct answer 1 Water will flow into the beaker.pdf
 
Choose the best description of a cDNA library a mixture o.pdf
Choose the best description of a cDNA library a mixture o.pdfChoose the best description of a cDNA library a mixture o.pdf
Choose the best description of a cDNA library a mixture o.pdf
 
Choose an indicator from The Canadian Environmental Sustaina.pdf
Choose an indicator from The Canadian Environmental Sustaina.pdfChoose an indicator from The Canadian Environmental Sustaina.pdf
Choose an indicator from The Canadian Environmental Sustaina.pdf
 
Chapter 7 Business and the Environment 1 What is intrins.pdf
Chapter 7  Business and the Environment 1 What is intrins.pdfChapter 7  Business and the Environment 1 What is intrins.pdf
Chapter 7 Business and the Environment 1 What is intrins.pdf
 
Choose a major country to research Australia Write a repo.pdf
Choose a major country to research Australia Write a repo.pdfChoose a major country to research Australia Write a repo.pdf
Choose a major country to research Australia Write a repo.pdf
 
Choose an article from US News 2020 Public Health https.pdf
Choose an article from US News 2020 Public Health https.pdfChoose an article from US News 2020 Public Health https.pdf
Choose an article from US News 2020 Public Health https.pdf
 
Chinas Great FirewallChina has a population of over 14 bil.pdf
Chinas Great FirewallChina has a population of over 14 bil.pdfChinas Great FirewallChina has a population of over 14 bil.pdf
Chinas Great FirewallChina has a population of over 14 bil.pdf
 
Choose ALL that are TRUEWhich of the following commonly uses.pdf
Choose ALL that are TRUEWhich of the following commonly uses.pdfChoose ALL that are TRUEWhich of the following commonly uses.pdf
Choose ALL that are TRUEWhich of the following commonly uses.pdf
 
Choose a product or service that you are familiar with some.pdf
Choose a product or service that you are familiar with some.pdfChoose a product or service that you are familiar with some.pdf
Choose a product or service that you are familiar with some.pdf
 
Chinas GDP expanded at its slowest pace since the mid1970s.pdf
Chinas GDP expanded at its slowest pace since the mid1970s.pdfChinas GDP expanded at its slowest pace since the mid1970s.pdf
Chinas GDP expanded at its slowest pace since the mid1970s.pdf
 

Recently uploaded

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 

Recently uploaded (20)

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

ClassF Class A public void greatObject o S.pdf

  • 1. ClassF{ } Class A{ public void great(Object o){ System.out.print("yeah"); } } Class B extends A{ public void great(Object o){ System.out.print("ha"); } public void great(F o){ System.out.print("ha"); } } public class testing{ public static void main(String[] arg){ F f1=new F(); B b1=new B(); B.great(f1); } } Question: Why here overloading takes precedent than Overriding? and print "ha", since f is also an object, why doesn't it goes it the first great(object o) I think both of the great in class B works. Can you explain?