本帖最后由 孙政 于 2013-5-3 10:57 编辑
- class Student
- {
- Student( )
- {
- System.out.println("student read");
- }
- Student(int x)
- {
- System.out.println("student:"+x);
- }
- }
-
- class Sun extends Student
- {
- Sun ( )
- {
- System.out.println("sun read");
- }
- Sun (int x)
- {
- this( );
- super(6);
- System.out.println("sun:"+x);
- }
- }
-
- class ExtendsDemo1
- {
- public static void main(String[] args)
- {
- Sun s1=new Sun ( );
- Sun s2=new Sun (5);
- }
- }
复制代码 调试运行了哈,在this()和super()那里有问题,不知道为什么,请大家帮忙解释下? |