内部类对象的创建要通过外部类对象go()中的f.addMouseMotionListener(new MoseMotionHandler());
        f.addMouseListener(new MousrEventHandler());应改为 f.addMouseMotionListener(this.new MouseMotionHandler());
       f.addMouseListener(this.new MouseEventHandler());你的程序中还有好几处错误 我改了一下import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TwoListenerInner extends MouseMotionAdapter {
private Frame f;
private TextField tf;
// MouseMotionHandler为一个内部类
  public class MouseMotionHandler extends MouseMotionAdapter{
  public void mouseDragged(MouseEvent e){
  String s="Mouse dragging : X="+e.getX()+"Y="+e.getY();
  tf.setText(s);
  }
  }
  //MouseEventHandle为一个内部类
  public class MouseEventHandler extends MouseAdapter{
  public void MouseEntered(MouseEvent e){
  String s="The mouse entered";
  tf.setText(s);
  }
  }
  public void mouseExited(MouseEvent e){
  String s="The mouse has left the building";
  tf.setText(s);
  }
public static void main(String[] args) {
TwoListenerInner that=new TwoListenerInner();
that.go();
}
public void go(){
f=new Frame("Two listeners example");
f.add("North",new Label("Click and drag the mouse"));
tf=new TextField(10);
f.addMouseMotionListener(this.new MouseMotionHandler());
f.addMouseListener(this.new MouseEventHandler());
f.setSize(300,200);
f.setVisible(true);
}

}