但是我觉得this.ds = ds.
this.ds和ds是两个不同的参数丫,ds是形参嘛,Send的属性ds可以定义成私有的嘛!

解决方案 »

  1.   

    将变量改为public 还是报错的。
      

  2.   

    不好意思,找到错误的地方了。第5行。构造方法,不应该有参数,
     public void send(DatagramSocket ds){
            this.ds = ds;
        }
    应该写成:public Send(DatagramSocket ds){
      this.ds =ds;
    }
    还有main方法public static void main() throws Exception,
    应该写成:public static void main(String[] args) throws Exception{
      

  3.   

    兄弟,之前你的构造方法是小写send