标题JAVA Eclipse 常见的异常或错误类型
1.Syntax error on token “.”, @ expected after this token
表示代码要写在主方法体中,通常是因为在类中忘记写主方法,而直接将代码块写在了类体之内。例如:
`public class Test {
Master Zhangsan = new Master();
Cat cat1 = new Cat();
Dog dog1 = new Dog();
Snake snake1 = new Snake();
Zhangsan.feed(cat1); //此时,编译器会在“.”和“;”下出现红线,显示编译报错,提示为 Syntax error on token ".", @ expected after this token
}`