- 2
Inheritance and implementation are two different things.
If the Superclass Calculator is an abstract class, next to the class name near the top of the program, type the keyword "implements" and the name of the class that you want the subclass to implement, or "Calculator". With implementation, you may override the existing methods in the Calculator class, but the methods have to hold the same name.
Ex: public class SubClass implements Calculator {
@Override
public void Method1 (int i){
//Method1 is from Calculator class
}
}
However, if Calculator is not an abstract class, change "implements" to "extends". With inheritance, you may use the public variables and methods from the superclass in the subclass. You may not use private variables/methods nor can you override the methods from the superclass in the subclass.
Ex: public class SubClass extends Calculator {
double totalBal += bankBal;
//variable bankBal is from Calculator class
}
I hope this helps.