Q.- Given the code fragment:
1. abstract class Planet {
2. protected void revolve( ) {
3. }
4. abstract void rotate ( );
5. }
6.
7. class Earth extends Planet {
8. private void revolve( ) {
9. }
10. private void rotate ( ) {
11. }
12. }
Which two modifications enable the code to compile?
A) Make the method at line 4 public.
B) Make the method at line 2 public.
C) Make the method at line 8 public.
D) Make the method at line 8 protected.
E) Make the method at line 10 protected.
⧪ please give your answer in a comment section.
1. abstract class Planet {
2. protected void revolve( ) {
3. }
4. abstract void rotate ( );
5. }
6.
7. class Earth extends Planet {
8. private void revolve( ) {
9. }
10. private void rotate ( ) {
11. }
12. }
Which two modifications enable the code to compile?
A) Make the method at line 4 public.
B) Make the method at line 2 public.
C) Make the method at line 8 public.
D) Make the method at line 8 protected.
E) Make the method at line 10 protected.
⧪ please give your answer in a comment section.
4 Comments
C
ReplyDeletec
ReplyDeleteC
ReplyDeleteC ) Make the method at line 8 public.
ReplyDeleteD) Make the method at line 8 protected.