i have a couple of question about the below code.
is it possible to call the SuperClass's printMethod from the main method in the subclass? Or can the SuperClass's printMethod only be called by using the super keyword from the subclass's printMethod?
class Superclass {
void printMethod() {
System.out.println("Printed in Superclass.");
}
}
//Here is a subclass, called Subclass, that overrides printMethod().
class Subclass extends Superclass {
void printMethod() { //overrides printMethod in Superclass.
super.printMethod();
System.out.println("Printed in Subclass.");
}
public static void main(String[] args) {
Subclass s = new Subclass();
s.printMethod();
}
}