fork download
  1. class Test {
  2. private final int foo;
  3.  
  4. public void setFoo(int bar) {
  5. foo = bar;
  6. }
  7.  
  8. public Test() {
  9.  
  10. }
  11.  
  12. public static void main (String[] args) {
  13. Test qux = new Test();
  14. qux.setFoo(42);
  15. System.out.println("did it");
  16. }
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:5: error: cannot assign a value to final variable foo
		foo = bar;
		^
1 error
stdout
Standard output is empty