this
代表"这个"类(Class)的对象(Object)或叫实例(instance)

解决方案 »

  1.   

    class A extend SuperClass
    {
        private float Width;
        public float getWidth()
        {
           return this.Width;
        }
    }class B extend SuperClass
    {
        private float Width;
        public float getWidth()
        {
           return this.Width;
        }
    }
      

  2.   

    Abstract class SuperClass
    {
        public public float getWidth();
    }
      

  3.   

    Abstract class SuperClass
    {
        float Width;
        float getWidth(SuperClass obj);
    }class A extend SuperClass
    {
        public A(float t)
        {
            Width=t;
        }
        public float getWidth(SuperClass obj)
        {
           return Width;
        }
    }class B extend SuperClass{
         public B(float t)
        {
            Width=t;
        }
        public float getWidth(SuperClass obj)
        {
           return Width;
        }
    }A a=new A("23.32");
    float AWidth=a.getWidth(this);
      

  4.   

    你们搞错了,我是问image对象的这个方法需要什么参数,this我再不知道,我就不搞java了。
      

  5.   

    从JDK文档是摘的
    ------------------------
    getWidth public abstract int getWidth(ImageObserver observer) Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.Parameters:
    observer - an object waiting for the image to be loaded.Returns:
    the width of this image, or -1 if the width is not yet known.See Also: getHeight(java.awt.image.ImageObserver), ImageObserver---------------------------------
    public interface ImageObserver An asynchronous update interface for receiving notifications about Image information as the Image is constructedAll Known Implementing Classes: 
    Component
    ---------------------------------
    Class Component java.lang.Object
      |
      +--java.awt.Component All Implemented Interfaces: ImageObserver, MenuContainer, Serializable
    ---------------------------------
    Component是所有组件的父类,明白了吧
      

  6.   

    observer有什么用?它是如何起作用的?怎么才知道文件已经装载完
      

  7.   

    其实我从没用到过observer,我建立Image时每次observer参数都传入null,调用getHeight和getWidth也传入null就行了。我觉得observer好像没什么大的用处,看看Graphics中的这个方法drawImage public abstract boolean drawImage(Image img,
                                               int x,int y,ImageObserver observer)Draws as much of the specified image as is currently available. ······
    If the image has not yet been completely loaded, then drawImage returns false. 
    As more of the image becomes available, the process that draws the image notifies the specified image observer.从字面上看他无非就担当一个类似监听者的作用,如果图片文件载入完成,则向这个observer发notify以唤醒之(可能之前observer由于某个原因被阻塞了)不知他人有何高见?