红联Linux门户
Linux帮助

有关JAVA调试中出现的问题,请各位帮我一下!谢谢啊!

发布时间:2005-05-17 21:16:54来源:红联作者:wade9900
class SuperClass
{
int x;
SuperClass()
{
x=3;
System.out.print("in SuperClass:x"+x);
}
void doSomething()
{
System.out.print("in SuperClass.doSomething()");
}
}
class SubClass extends SuperClass
{
int x;
SubClass()
{
super();
x=5;
System.out.print("in SubClass:x="+x);
}
void doSomething()
{
super.doSomething();
System.out.print("in SubClass.doSomething()");
System.out.print("super.x="+super.x+"sub.x="+x);
public class inheritance
{
public static void main(String[]args)
{
SubClass subC=new SubClass();
subC.doSomething();
}
}


我的油箱是wade9900@yahoo.com.cn
谢谢你们的帮忙!谢谢啊!
文章评论

共有 2 条评论

  1. ai0909 于 2011-10-21 16:12:33发表:

    路过。。。

  2. wade9900 于 2005-05-17 21:26:22发表:

    经过自己认真的调试跟检查!终于得到答案了啊!谢谢各位啊!


    class SuperClass
    {
    int x;
    SuperClass()
    {
    x=3;
    System.out.print("in SuperClass:x="+x);
    }
    void doSomething()
    {
    System.out.print("in SuperClass.doSomething()");
    }
    }
    class SubClass extends SuperClass
    {
    int x;
    SubClass()
    {
    super();
    x=5;
    System.out.print("in SubClass:x="+x);
    }
    void doSomething()
    {
    super.doSomething();
    System.out.print("in SubClass.doSomething()");
    System.out.print("super.x="+super.x+"sub.x="+x);
    }
    }
    public class inheritance
    {
    public static void main(String[]args)
    {
    SubClass subC=new SubClass();
    subC.doSomething();
    }
    }