The public type Test1 must be defined in its own file
时间: 2024-05-25 22:12:08 浏览: 282
Tomcat ssl报错Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法
This error message usually occurs when you have defined a public class or interface in a Java file whose name does not match the class/interface name. To fix this error, you can do one of the following:
1. Rename the Java file to match the public class/interface name.
2. Move the public class/interface to a new Java file with the correct name.
3. Make the class/interface package-private (remove the "public" modifier) if it does not need to be accessed from outside its package.
Here's an example:
// file name: MyClass.java
public class Test1 {
// ...
}
In this case, the file name should be renamed to Test1.java to match the public class name.
阅读全文