As others have already answered the question (both call super.Output() or just call Output() are correct), I will attempt to give a little more clarity as to why both are correct (and it's mostly due to your naming conventions).
When you have a parent-child relationship between classes, like so:
class A {
public void doStuff(){
System.out.println("Doing A Stuff!");
}
}
class B extends A {
public void doStuff(){
System.out.println("Doing B Stuff!");
}
}
What you are doing is overriding the doStuff method. The behaviour will be as follows:
A a = new B(); // A is the parent type of a, B is the actual type.
a.doStuff(); // prints "Doing B stuff!"
When you override in Java, the method has to have the exact same name, parameters list (in the same order), and return type. So in your example Output1 is NOT an override of Output. This is why you actually can get away with calling Output() anywhere in your subclass, without the need for the 'super' keyword. If you were to refactor your code so that both methods had the same signature, then yes, the only way to call the behaviour of the parent class is to call super.Output() in the overriding method. In fact, if you then wrote your subclass B in the following way, the call to doStuff would be a recursive call and the method would recurse until you hit a stack overflow (hence, you need to use super.doStuff()):
class B extends A {
public void doStuff(){
doStuff(); // BAD CODE!! Use super.doStuff() here instead!
System.out.println("Doing B Stuff!");
}
}
Another way you could ensure you call the superclass's method is to instantiate the object with an actual type of the supertype, but then you lose all of the functionality of the subclass:
A a = new A(); //both parent type and actual type of a is A
a.doStuff(); // prints "Doing A stuff!" (can't print "Doing B Stuff!")
Also, as commented, you should check out this question which will point you in the direction of official Java style guidelines and conventions. Some quick things to note about your code is the lack of lower camel case for local variables (A1 should be a1) and methods (Output() should be output())
Output1()in the subclass instead ofOutput()?