I have the following code as part of the destination
class Base { public static void main(String[] args){ System.out.println("Hello World"); } } public class Factorial extends Base{ }
My task runs the code and then explains the output. The name of the file is Factorial.java . The code works without problems, and Hello World prints, which is surprising to me. Before entering the code, I thought that it would not compile, because the parent class that is expanding should be in a different file, but now I'm not sure. Will appreciate the clearance.
source share