【Java学习】-Inheritance syntax

You can create a main() for each one of your classes; this technique of putting a main() in each class allows easy testing for each class.

Even if you have a lot of classes in a program, only the main() for the class invoked on the command line will be called. Even if a class has package access, a public main() is accessible.

So to allow for inheritance, as a general rule, make all fields private and all methods public.

上一篇:右键没有word?excel?ppt?注解表该改改啦


下一篇:Mac上 制作自己的VOC数据集