//UDPServer.javaimport java.net.*;public class UDPServer {
public static void main(String[] agrs)throws Exception {
byte[] buf = new byte[1024];
DatagramPacket c = 
new DatagramPacket(buf, buf.length);
DatagramSocket d = new DatagramSocket(1886); while(true) {
d.receive(c);
System.out.println(new String(buf, 0, c.getLength()));
}

}
}
//UDPClient.javaimport java.net.*;public class UDPClient{
public static void main(String[] agrs)throws Exception {
byte[] buf = (new String("yangyongjie")).getBytes();
DatagramPacket aa = 
new DatagramPacket(
buf, buf.length, new InetSocketAddress(
"192.168.132.15", 1886));
DatagramSocket cc = new DatagramSocket(9999); cc.send(aa);
cc.close();
}
}
//运行上面的Server没问题 但是 一运行Client程序就 发出这个错误 :
Exception in thread "main" java.lang.NoSuchMethodError: main
//不知道错在哪里 高手讲解下 谢谢!