the blank final field factors may not have been initialized

Q1: why we should initialize final field before completion of new instance?

  final means no changeable in java enviroment, the java compiler urges us follow the security violation.

Q2: how to resolve the error above?

  actually, it is because factors perhaps refer to passed parameter.

     so , keeping a good habit to add the prefix 'this.' is good manner to resolve the error.

  this.factors = Arrays.copyof....

猜你喜欢

转载自www.cnblogs.com/daniel123/p/9066487.html