你这个
class dog { ...操作,函数 } public class testDog { public static void main(String [] args) { d1.say(); } }
好像没有问题,报错信息是什么呢
主函数要写在Dog类下才能运行