[求助]DatagramSocket的短程序,编译过了但是执行不过,请大家指错
import java.net.*; class aclient{ public static void main(String args[]) { byte[] data={19,21,26,24,57,58,54,21}; try { DatagramSocket ds; DatagramPacket pkt; pkt=new DatagramPacket(data,data.length,InetAddress.getLocalHost(),8888); ds.send(pkt); ds.close(); }catch (Exception e){} } } 编译过了,但是运行时报错 "可能未初始化变量 ds" 怎么回事啊?求大家帮忙解答一下! |