The main problem with your class BenHultinProg4 is that you are putting all kinds of statements directly in the class declaration. That doesn't work. You need to create methods, and put those statements inside methods. You can't, for example, call System.out.printf(...) at class level. You can only do that inside a method.