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

2.(10 pts.) Given the following class declarations that are in the same package.

ID: 3711326 • Letter: 2

Question

2.(10 pts.) Given the following class declarations that are in the same package. C1o public class myclassl pts. public double dvarl; protected double dvar2; double dvar3 private double dvar 4: Priva ate protected void mlO ) private void m20 !.) public void m30 (.) Ohst ass T oll myclassl O ) owing a angle t ricob public class myclass2 extends myclassl( a) List the member variables and methods in myclass1 that are accessible in myclass2. b) Which methods in myclassi can be overriden in myclass2? publoe c) Can the method m3 0 in myclass1 be declared a private method in myclass2? ublse insta anc Explain ance eof

Explanation / Answer

a) member variables: dvar1, dvar2, dvar3 methods: m1, m3 Explanation: All variables and methods of myclass1 which are not private are accessible in myclass2 b) m1 and m3 Explanation: All methods of myclass1 which are not private can be overriden in myclass2 c) Yes a public method in myclass1 class can be declared with any access modifier(public, protected, private) in myclass2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote