In intellij the program compiles correctly.