Line29 super() explicitly calls the superclass BankAccount default constructor. the private field interestRate is set to a fixed value 0.03.
super(startBalance) explicitly calls the superclass BankAccound overloaded class with the required parameter startBalance. startInterestRate is also a required input of this overloaded class for calling the method setInterestRate.
The method applyInterest() calls the method deposit() in superclass.
I created a new toString() method in this class but I can still access to the toString() method in the superclass by using super.toString().
I created a NumberFormat object for formatting the field interestRate by using the getPercentageInstance() method.
There is another way to write this:
NumberFormat percentage = new NumberFormat.getPercentInstance(); super.toString() + percentage.format(interestRate);
Real Life Application & Conclusion
This logarithm can be applied to bank system and any investment system. The inheritance function is really useful since there is no repetition of codes. The toString() is a new method too which shows the value stored in the system. And remember, when you create a new toString() in sub class, you can still use super.toString() to call the toString() in the super class.