Common design practice is to make instance variables private and have public getters and setters to access them. But many times I have seen code samples on the internet that
This is perfectly normal. Some variables might need to be initialized as soon as the object is created, hence it makes sense to pass them in the constructor and many times we may not want to provide setters for those variables to avoid changing the values after object is created.