[Solved] Java declaring private member variables [duplicate]


You can initialize the variable either inside the constructor or outside, both have their benefits and drawbacks. There are a few reasons as explained in the following threads:

  • Should I initialize variable within constructor or outside constructor

  • Should I instantiate instance variables on declaration or in the constructor?

2

solved Java declaring private member variables [duplicate]