enter image description here
The error in your code occurs because the permuter method and the code that follows it are not enclosed within a class. In Java, all methods and statements must be inside a class.
When the Java compiler encounters code that is not inside a class, it doesn’t know what to do with it, as classes are the building blocks of Java programs. Therefore, it throws an error stating “class, interface, enum, or record expected,” indicating that it was expecting a class declaration but found something else.
baouchi aziz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.