Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#9 The following code snippet (code-9-1.txt) shows two partial classes. Student

ID: 3704899 • Letter: #

Question

#9 The following code snippet (code-9-1.txt) shows two partial classes. Student class and person class each with the same method named reset. Is this an example of overriding, overloading, or an error? code-9_1txt #10 Write the code that will call the reset method in the Person class in #9 above. #11 Write the code that will call the reset method in the Student class in #9 above. #12 If you try to copy the code from the code-9-1.txt file found in #9 and paste it into Eclipse, it will cause an error at the beginning of the Person class. What is the error? How do you fix it? #13 After you make the fix noted in #12 above, there is a triangle to the left of the second reset method in the Student class. What is the message when you hover over the triangle to the left of the second reset method in the Student class? #14 Can you overload a method if you only have one class? #15 Can you override a method if you only have one class? #16 Do you need an overloaded method or an overridden method to use polymorphism?

Explanation / Answer

Hi Dear, from Q9 to Q13 , you have to post code-9.txt.

I have answered Q 14, 15 and 16

As per the chegg guideline, please post one Question per post.

Q14. Can you overload a method if you only have one class ?

Ans: Yes.

Ex:

class A {

    public void sum(double x, double y) {

   }

    public void sum(int x, double y) {

   }

}

Q15. Ans: NO.

Override comes to existence when Inheritence is there , means more than one classes

Q16. Ans:

Method overriding is the ways in which Java supports Runtime Polymorphism.

Method overloading is the ways in which Java supports Static Polymorphism.

Please DONT forgot to rate my answer. We are working hard for you Guys!!