the public type HsTank must be defined in its own file??

来源:百度知道 编辑:UC知道 时间:2024/06/15 06:38:38

你的HsTank没写在HsTank.java这个文件中,看看你是不是类名写错了或是文件名写错了

1)在Android中 默认是公有类(public class)应该和文件名(文件名.java)一致,公有类可以供外部类调用。如果不一致就是提示:
“the public type **** must be defined in its own file”

2)当声明某个类只在某个文件(文件名.java)使用,就不需要声明为公有类。