Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain why. Question 6 (5 pts) Examine the code below. Comment out any statements that result in compile-time errors. Trace and give output of
Please explain why.
Question 6 (5 pts) Examine the code below. Comment out any statements that result in compile-time errors. Trace and give output of the code segment. class Planetf protected string around; public Planet (String ar) \{around = ar; public void show () \{ System. out.println ("Orbit around: "+around); 1 f class ExoPlanet extends Planetf private int year; public ExoPlanet (String ar, int year) \{super(ar); this+year = year; \} public void show () System, out.println ("Orbit around: "taround); 1 public void discovered()f System. out.println ("Discovered: "+year); 1 \} public class Midterm f public static void main(String [] args) f Planet planet = new Planet ("Sun"); ExoPlanet exo = new ExoPlanet ("Alpha Centauri", 1992); planet = exo; planet. show (); planet. discovered (); exo.discovered (); \} \}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started