Your variables in your code are of types no , but x is created first before calling the constructor. (Do a null check for x on the constructor to find out).
As for the recommendation, it is up to you. One thing, for example. in JavaBeans, since I usually donβt write a standard default constructor (without arguments), I usually initialize some fields in the declaration (if they are necessary so that they are not empty). Otherwise, I will create them in the constructor.
Buhake sindi
source share