1. 程式人生 > >the blank final field factors may not have been initialized

the blank final field factors may not have been initialized

bubuko pass ror actual sed parameter ble bit add

技術分享圖片

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....

the blank final field factors may not have been initialized