哪位大虾帮小弟看看这个程序有什么问题?先行谢过了! //showWords.java class words { String Words1,Words2; void set_words1(String words1) {Words1=words1;} void set_words2(String words2) {Words2=words2;} void show_message() { System.out.println("The whole words is "+Words1+Words2); } } class Words extends words { void show_message2() { System.out.println("The whole words is "+Words2+Words1); } } class showWords { public static void main(String args[]) { Words wrd1=new Words(); Words wrd2=new Words(); wrd1.set_words1("cool"); wrd2.set_words2("feiying"); wrd1.show_message(); wrd2.show_message(); }
} 理论上是会显示“The whole words is coolnull” “The whole words is nullfeiying” 但是编译时不能产生Words.class文件,执行showWords就有问题了。