I’m studying OOP using the Java How to Program Book. In exercise 4.19 – (Sales Commission Calculator) when I try to solve it. If we have two constructorswhen you call oneof them, JVMwill ignore the other one.
Check the pictures to know more.
1. case 1:
In the default constructor I just initialized
this.rate = 0.09;
variable, but I didn’t use this constructorby the way!
2.case 2:
I did initialize
this.rate = 0.09;
with a non-zero value, if I didn’t give it a value, the compiler will equal it to zero **
**Note: this is an opinion, I’m a student, if you have another answer for this case, please tell me! Thanks!