Consider the following class definitions.
public class First
{
public void output1()
{
output2();
}
public void output2()
{
output3();
}
public void output3()
{
System.out.print("First");
}
}
public class Second extends First
{
public void output()
{
output1();
output2();
output3();
}
}
public class Third extends Second
{
public void output3()
{
System.out.print("Third");
}
}
The following code segment appears in a class other than First, Second, or Third.
First sec = new Second(); // Line 1
Second thr = new Third(); // Line 2
sec.output(); // Line 3
thr.output(); // Line 4
Which of the following best explains why the code segment will not compile?
A. Line 3 causes a compile-time error because the variable sec should be declared as type Second.
B. Line 4 causes a compile-time error because the variable thr should be declared as type Third.
C. Line 3 causes a compile-time error because the Second class is missing the output1 method.
D. Line 3 causes a compile-time error because the Second class is missing the output2 method.
E. Line 4 causes a compile-time error because the Third class is missing the output method.