Java - Should private instance variables be accessed in constructors through getters and setters met
- by Yatendra Goel
I know that private instance variables are accessed through their public getters and setters method.
But when I generate constructors with the help of IDE, it initializes instance variables directly instead of initializing them through their setter methods.
Q1. So should I change the IDE generated code for constructors to initialize those instance variables through their setter methods.
Q2. If yes, then why IDE don't generate constructors code in that way?