SlideShare a Scribd company logo
1 of 3
Will the following code compile?
abstract class A {
public int do_stuff1() {
return 3;
}
}
class B extends A {
@Override
public int do_stuff1() {
return 4;
}
public int do_stuff2() {
return 7;
}
}
class Main {
public static void main(String[] args) {
//Note the polymorphism:
A myB = new B();
myB.do_stuff1();
myB.do_stuff2();
}
}
Will the following code compile?
abstract class A {
public int do_stuff1() {
return 3;
}
}
class B extends A {
@Override
public int do_stuff1() {
return 4;
}
public int do_stuff2() {
return 7;
}
}
class Main {
public static void main(String[] args) {
//Note the polymorphism:
A myB = new B();
myB.do_stuff1();
myB.do_stuff2();
}
}
No, Class C can't extend one class (B) and implement an interface (1A), it can only do one or the
other. No, Class C doesn't correctly override do_stuff2() No, class C cannot be instantiated
because it implements an interface. Yes

More Related Content

Similar to Will the following code compile- abstract class A { public int do_ (1).docx

Indus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answersIndus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answersSushant Choudhary
ย 
T1
T1T1
T1lksoo
ย 
Java interface
Java interfaceJava interface
Java interfaceArati Gadgil
ย 
E5
E5E5
E5lksoo
ย 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
ย 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple InheritanceBhavyaJain137
ย 
Multiple choice questions for Java io,files and inheritance
Multiple choice questions for Java io,files and inheritanceMultiple choice questions for Java io,files and inheritance
Multiple choice questions for Java io,files and inheritanceAbishek Purushothaman
ย 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructorSelvin Josy Bai Somu
ย 
Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSESujata Regoti
ย 
Lecture 5 Inheritance
Lecture 5 InheritanceLecture 5 Inheritance
Lecture 5 Inheritancebunnykhan
ย 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdfstudy material
ย 
Uta005
Uta005Uta005
Uta005Daman Toor
ย 
FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER Syahriha Ruslan
ย 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Abou Bakr Ashraf
ย 
Inheritance and Interfaces
Inheritance and InterfacesInheritance and Interfaces
Inheritance and InterfacesNAGASURESH MANOHARAN
ย 

Similar to Will the following code compile- abstract class A { public int do_ (1).docx (20)

Indus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answersIndus Valley Partner aptitude questions and answers
Indus Valley Partner aptitude questions and answers
ย 
7
77
7
ย 
Scjp6.0
Scjp6.0Scjp6.0
Scjp6.0
ย 
T1
T1T1
T1
ย 
Qno 2 (b)
Qno 2 (b)Qno 2 (b)
Qno 2 (b)
ย 
Java interface
Java interfaceJava interface
Java interface
ย 
E5
E5E5
E5
ย 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
ย 
Multiple Inheritance
Multiple InheritanceMultiple Inheritance
Multiple Inheritance
ย 
Multiple choice questions for Java io,files and inheritance
Multiple choice questions for Java io,files and inheritanceMultiple choice questions for Java io,files and inheritance
Multiple choice questions for Java io,files and inheritance
ย 
Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
ย 
Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSE
ย 
Lecture 5 Inheritance
Lecture 5 InheritanceLecture 5 Inheritance
Lecture 5 Inheritance
ย 
C test
C testC test
C test
ย 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
ย 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdf
ย 
Uta005
Uta005Uta005
Uta005
ย 
FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER
ย 
Visula C# Programming Lecture 8
Visula C# Programming Lecture 8Visula C# Programming Lecture 8
Visula C# Programming Lecture 8
ย 
Inheritance and Interfaces
Inheritance and InterfacesInheritance and Interfaces
Inheritance and Interfaces
ย 

More from EvanadoJamesz

Which of the following statements is false- a- Archaea and bacteria ha.docx
Which of the following statements is false- a- Archaea and bacteria ha.docxWhich of the following statements is false- a- Archaea and bacteria ha.docx
Which of the following statements is false- a- Archaea and bacteria ha.docxEvanadoJamesz
ย 
Which Severity is higher- Pool A or Pool B- Select an answer and subm.docx
Which Severity is higher- Pool A or Pool B-  Select an answer and subm.docxWhich Severity is higher- Pool A or Pool B-  Select an answer and subm.docx
Which Severity is higher- Pool A or Pool B- Select an answer and subm.docxEvanadoJamesz
ย 
Which stage of an action potential would be the target (or most affect.docx
Which stage of an action potential would be the target (or most affect.docxWhich stage of an action potential would be the target (or most affect.docx
Which stage of an action potential would be the target (or most affect.docxEvanadoJamesz
ย 
Which of the following statements comparing photosynthesis and cellula.docx
Which of the following statements comparing photosynthesis and cellula.docxWhich of the following statements comparing photosynthesis and cellula.docx
Which of the following statements comparing photosynthesis and cellula.docxEvanadoJamesz
ย 
Which register Motorola 68000 is designated to keep flags of operation.docx
Which register Motorola 68000 is designated to keep flags of operation.docxWhich register Motorola 68000 is designated to keep flags of operation.docx
Which register Motorola 68000 is designated to keep flags of operation.docxEvanadoJamesz
ย 
Which of the following statements is true about the scientific managem.docx
Which of the following statements is true about the scientific managem.docxWhich of the following statements is true about the scientific managem.docx
Which of the following statements is true about the scientific managem.docxEvanadoJamesz
ย 
Which one of the goals listed is an example of a strategic goal Twitte.docx
Which one of the goals listed is an example of a strategic goal Twitte.docxWhich one of the goals listed is an example of a strategic goal Twitte.docx
Which one of the goals listed is an example of a strategic goal Twitte.docxEvanadoJamesz
ย 
Which of the following traits do Archaea and Bacteria share- 1- compos.docx
Which of the following traits do Archaea and Bacteria share- 1- compos.docxWhich of the following traits do Archaea and Bacteria share- 1- compos.docx
Which of the following traits do Archaea and Bacteria share- 1- compos.docxEvanadoJamesz
ย 
Which of the following statements about errors in cell division is fal.docx
Which of the following statements about errors in cell division is fal.docxWhich of the following statements about errors in cell division is fal.docx
Which of the following statements about errors in cell division is fal.docxEvanadoJamesz
ย 
Which of the following statements is most likely incorrect- Which of t.docx
Which of the following statements is most likely incorrect- Which of t.docxWhich of the following statements is most likely incorrect- Which of t.docx
Which of the following statements is most likely incorrect- Which of t.docxEvanadoJamesz
ย 
Which of the following statements is an accurate description of Newton.docx
Which of the following statements is an accurate description of Newton.docxWhich of the following statements is an accurate description of Newton.docx
Which of the following statements is an accurate description of Newton.docxEvanadoJamesz
ย 
Which of the following statements regarding endochondral ossification.docx
Which of the following statements regarding endochondral ossification.docxWhich of the following statements regarding endochondral ossification.docx
Which of the following statements regarding endochondral ossification.docxEvanadoJamesz
ย 
Which of the following programs multiply the contents of the D1 regist.docx
Which of the following programs multiply the contents of the D1 regist.docxWhich of the following programs multiply the contents of the D1 regist.docx
Which of the following programs multiply the contents of the D1 regist.docxEvanadoJamesz
ย 
Which of the following statements is true- Explain why each statement.docx
Which of the following statements is true- Explain why each statement.docxWhich of the following statements is true- Explain why each statement.docx
Which of the following statements is true- Explain why each statement.docxEvanadoJamesz
ย 
Which one is a block tag- A- epres B- h1- C- E-.docx
Which one is a block tag- A- epres B- h1- C-  E-.docxWhich one is a block tag- A- epres B- h1- C-  E-.docx
Which one is a block tag- A- epres B- h1- C- E-.docxEvanadoJamesz
ย 
Which one is NOT a primary factor of an environmental assessment- Soci.docx
Which one is NOT a primary factor of an environmental assessment- Soci.docxWhich one is NOT a primary factor of an environmental assessment- Soci.docx
Which one is NOT a primary factor of an environmental assessment- Soci.docxEvanadoJamesz
ย 
Write a java program using BlueJ- a) Create a class -Patient- with dat.docx
Write a java program using BlueJ- a) Create a class -Patient- with dat.docxWrite a java program using BlueJ- a) Create a class -Patient- with dat.docx
Write a java program using BlueJ- a) Create a class -Patient- with dat.docxEvanadoJamesz
ย 
Write a JAVA program with two classes- First class called Calclastname.docx
Write a JAVA program with two classes- First class called Calclastname.docxWrite a JAVA program with two classes- First class called Calclastname.docx
Write a JAVA program with two classes- First class called Calclastname.docxEvanadoJamesz
ย 
Write a Java method that takes two linked lists of integers- and and m.docx
Write a Java method that takes two linked lists of integers- and and m.docxWrite a Java method that takes two linked lists of integers- and and m.docx
Write a Java method that takes two linked lists of integers- and and m.docxEvanadoJamesz
ย 
Write a java program using BlueJ- a) Create a class shop that contains.docx
Write a java program using BlueJ- a) Create a class shop that contains.docxWrite a java program using BlueJ- a) Create a class shop that contains.docx
Write a java program using BlueJ- a) Create a class shop that contains.docxEvanadoJamesz
ย 

More from EvanadoJamesz (20)

Which of the following statements is false- a- Archaea and bacteria ha.docx
Which of the following statements is false- a- Archaea and bacteria ha.docxWhich of the following statements is false- a- Archaea and bacteria ha.docx
Which of the following statements is false- a- Archaea and bacteria ha.docx
ย 
Which Severity is higher- Pool A or Pool B- Select an answer and subm.docx
Which Severity is higher- Pool A or Pool B-  Select an answer and subm.docxWhich Severity is higher- Pool A or Pool B-  Select an answer and subm.docx
Which Severity is higher- Pool A or Pool B- Select an answer and subm.docx
ย 
Which stage of an action potential would be the target (or most affect.docx
Which stage of an action potential would be the target (or most affect.docxWhich stage of an action potential would be the target (or most affect.docx
Which stage of an action potential would be the target (or most affect.docx
ย 
Which of the following statements comparing photosynthesis and cellula.docx
Which of the following statements comparing photosynthesis and cellula.docxWhich of the following statements comparing photosynthesis and cellula.docx
Which of the following statements comparing photosynthesis and cellula.docx
ย 
Which register Motorola 68000 is designated to keep flags of operation.docx
Which register Motorola 68000 is designated to keep flags of operation.docxWhich register Motorola 68000 is designated to keep flags of operation.docx
Which register Motorola 68000 is designated to keep flags of operation.docx
ย 
Which of the following statements is true about the scientific managem.docx
Which of the following statements is true about the scientific managem.docxWhich of the following statements is true about the scientific managem.docx
Which of the following statements is true about the scientific managem.docx
ย 
Which one of the goals listed is an example of a strategic goal Twitte.docx
Which one of the goals listed is an example of a strategic goal Twitte.docxWhich one of the goals listed is an example of a strategic goal Twitte.docx
Which one of the goals listed is an example of a strategic goal Twitte.docx
ย 
Which of the following traits do Archaea and Bacteria share- 1- compos.docx
Which of the following traits do Archaea and Bacteria share- 1- compos.docxWhich of the following traits do Archaea and Bacteria share- 1- compos.docx
Which of the following traits do Archaea and Bacteria share- 1- compos.docx
ย 
Which of the following statements about errors in cell division is fal.docx
Which of the following statements about errors in cell division is fal.docxWhich of the following statements about errors in cell division is fal.docx
Which of the following statements about errors in cell division is fal.docx
ย 
Which of the following statements is most likely incorrect- Which of t.docx
Which of the following statements is most likely incorrect- Which of t.docxWhich of the following statements is most likely incorrect- Which of t.docx
Which of the following statements is most likely incorrect- Which of t.docx
ย 
Which of the following statements is an accurate description of Newton.docx
Which of the following statements is an accurate description of Newton.docxWhich of the following statements is an accurate description of Newton.docx
Which of the following statements is an accurate description of Newton.docx
ย 
Which of the following statements regarding endochondral ossification.docx
Which of the following statements regarding endochondral ossification.docxWhich of the following statements regarding endochondral ossification.docx
Which of the following statements regarding endochondral ossification.docx
ย 
Which of the following programs multiply the contents of the D1 regist.docx
Which of the following programs multiply the contents of the D1 regist.docxWhich of the following programs multiply the contents of the D1 regist.docx
Which of the following programs multiply the contents of the D1 regist.docx
ย 
Which of the following statements is true- Explain why each statement.docx
Which of the following statements is true- Explain why each statement.docxWhich of the following statements is true- Explain why each statement.docx
Which of the following statements is true- Explain why each statement.docx
ย 
Which one is a block tag- A- epres B- h1- C- E-.docx
Which one is a block tag- A- epres B- h1- C-  E-.docxWhich one is a block tag- A- epres B- h1- C-  E-.docx
Which one is a block tag- A- epres B- h1- C- E-.docx
ย 
Which one is NOT a primary factor of an environmental assessment- Soci.docx
Which one is NOT a primary factor of an environmental assessment- Soci.docxWhich one is NOT a primary factor of an environmental assessment- Soci.docx
Which one is NOT a primary factor of an environmental assessment- Soci.docx
ย 
Write a java program using BlueJ- a) Create a class -Patient- with dat.docx
Write a java program using BlueJ- a) Create a class -Patient- with dat.docxWrite a java program using BlueJ- a) Create a class -Patient- with dat.docx
Write a java program using BlueJ- a) Create a class -Patient- with dat.docx
ย 
Write a JAVA program with two classes- First class called Calclastname.docx
Write a JAVA program with two classes- First class called Calclastname.docxWrite a JAVA program with two classes- First class called Calclastname.docx
Write a JAVA program with two classes- First class called Calclastname.docx
ย 
Write a Java method that takes two linked lists of integers- and and m.docx
Write a Java method that takes two linked lists of integers- and and m.docxWrite a Java method that takes two linked lists of integers- and and m.docx
Write a Java method that takes two linked lists of integers- and and m.docx
ย 
Write a java program using BlueJ- a) Create a class shop that contains.docx
Write a java program using BlueJ- a) Create a class shop that contains.docxWrite a java program using BlueJ- a) Create a class shop that contains.docx
Write a java program using BlueJ- a) Create a class shop that contains.docx
ย 

Recently uploaded

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.pptxPooja Bhuva
ย 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
ย 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
ย 
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 lessonhttgc7rh9c
ย 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
ย 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
ย 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
ย 
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 FellowsMebane Rash
ย 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
ย 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
ย 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
ย 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
ย 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
ย 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
ย 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
ย 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
ย 
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.pptxDr. Ravikiran H M Gowda
ย 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
ย 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
ย 
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_...Pooja Bhuva
ย 

Recently uploaded (20)

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
ย 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
ย 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
ย 
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
ย 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
ย 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
ย 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
ย 
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
ย 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
ย 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
ย 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
ย 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
ย 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
ย 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
ย 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
ย 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
ย 
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
ย 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
ย 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
ย 
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_...
ย 

Will the following code compile- abstract class A { public int do_ (1).docx

  • 1. Will the following code compile? abstract class A { public int do_stuff1() { return 3; } } class B extends A { @Override public int do_stuff1() { return 4; } public int do_stuff2() { return 7; } } class Main { public static void main(String[] args) { //Note the polymorphism: A myB = new B(); myB.do_stuff1(); myB.do_stuff2(); } }
  • 2. Will the following code compile? abstract class A { public int do_stuff1() { return 3; } } class B extends A { @Override public int do_stuff1() { return 4; } public int do_stuff2() { return 7; } } class Main { public static void main(String[] args) { //Note the polymorphism: A myB = new B(); myB.do_stuff1(); myB.do_stuff2(); } }
  • 3. No, Class C can't extend one class (B) and implement an interface (1A), it can only do one or the other. No, Class C doesn't correctly override do_stuff2() No, class C cannot be instantiated because it implements an interface. Yes