Home > Software engineering >  The final variable 'alignment' must be initialized
The final variable 'alignment' must be initialized

Time:09-01

I have this error when I try to run Alignment.Error in Alignment

CodePudding user response:

The final keyword stands for constant. Since it is a constant, not a variable, initialization is required. Remove the final keyword.

Because final is a constant keyword, its value cannot be changed.

There are two main keywords for constants: const and final. const is defined at compile time and final is defined at runtime.

CodePudding user response:

Just Remove final keyword .

otherwise you can not assign any value to alignment variable.

like this.

AlignmentDirectional alignment;

  • Related