A final field must be definitely assigned (once only) by the time the constructor completes. Since the constructor in that class doesn't assign to that field, the class won't compile. What you wrote in line 25 is a method, not a constructor, because its name isn't the same as the name of the class.
By the way: always start ClassNames With CapitalLetters.
Junilu Lacar wrote:. . . The intent was clearly to make a constructor . . .
All right then. I agree about the intent. But the compiler won't see that; it will see a method with missing return type.
I understand that it might be a illformed constructor and I quite honest don't completely understand everything I do. But if you look at my other git repository it worked completely fine. Github second repository
posted 3 weeks ago
The name of the class in line 20 (It should have started N not n) and the name of what you intended to be a constructor in line 25 are different. A constructor must have exactly the same name as the class and no return type. You can get serious errors if you mistakenly mark a constructor void because the javac tool won't issue any errors or warnings.
martin codey wrote:. . . don't completely understand everything I do.
In which case you should ask for explanations until you do understand what you are doing.
But if you look at my other git repository it worked completely fine. . . .
In which case, please let git or a diff program find the differences.
Always! Wait. Never. Shut up. Look at this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!