I\'m a bit confused about the use of getter/setters and constructors (see the below code for an example)
public class ExampleClass {
private in
My question is that if constructor is point of initialization and default constructor is always there so why we use constructor with parameters to initialize values instead of set get.
If you think about an object transitioning into different states then it makes sense to have a parameterized constructor alongwith setters and getters. Let me try to put a real life scenario: Think about an Employee class, a new employee joins, you don't know many details but few and you create the object of Employee with defualt and base value of its attributes. You need to register the employee in the system and hence you used the parameterized constructor. Once you get more details about the employee, you use getters and setters to update the attributes.