class Test { private final int myValue; public Test() { this.initMyValueBitchPlz(); } private void initMyValueBitchPlz() { this.myValue = 666; } public static void main (String[] args) { System.out.println(new Test().myValue); } }
Standard input is empty
Main.java:9: error: cannot assign a value to final variable myValue this.myValue = 666; ^ 1 error
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!