I saw this program in java book with tests and i can't understand, why this is the correct answer:
What will be the output of the program?
class Base
{
Base()
{
System.out.print("Base");
}
}
public class Alpha extends Base
{
public static void main(String[] args)
{
new Alpha(); /* Line 12 */
new Base(); /* Line 13 */
}
}
All answers:
- A.Base
- B.BaseBase
- C.Compilation fails
- D.The code runs with no output
Тhe correct answer is BaseBase
.