I checked all over the internet if you could reassign final variables in the constructor in java, and everywhere it said it were possible. Yet for me, in eclipse June 2019, it gives me an error when trying to do so:
Thank you for your help!
Here is the same code, as text:
public class FinalClass {
final int n = 5;
}
class InheritedClass extends FinalClass {
{
n = 6;
}
}
which when compiled from command line produces this error:
C:\stuff>javac FinalClass.java
FinalClass.java:7: error: cannot assign a value to final variable n
n = 6;
^
1 error