Syntax error on token "package", assert expected ------ step logging, expectedbeforetoken
Today, I encountered a pitfall when writing a program. eclipse Editor, JDK 1.7, and clean compiled the project and reported the error Syntax error on token "package", assert expected.
I repeatedly checked whether there were spelling errors or grammar rule errors. It was a bit confusing...
The information provided by the remote engineer is whether the package statement is in the first line, whether the import Statement is prior to the package statement, and whether there are multiple curly braces. Of course, none of them are possible... this is all the mistakes made by new people who just learned java. Okay...
After a variety of attempts, I finally found the problem: encoding.
It may be that the encoding format of the entire project is changed to GBK and changed to UTF-8 and clean. The problem is solved.
In the future, when you encounter a strange compilation problem, you may first look at the encoding format, whether it is still familiar with UTF-8...