| 发表于:2007-03-18 22:46:59 楼主 |
public class teacher extends person { public teacher () { super(); } public teacher(int a) { system.out.println (a); } public void func() { system.out.print ( "2, "); } public static void main(string[] args) { teacher t1 = new teacher (); //输出2 teacher t2 = new teacher(3);//输出2,3 } } class person { public person() { func(); } public void func() { system.out.println( "1, "); } } 正确的输出如注释所示 请详细的解释一下,谢 |
|
|
|
|