这段代码在Netbeans Java中返回了一个问题
public static void main(String str[]) throws Exception {
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
for (int i = 0; i < devices.length; i++) {
System.out.println(i + " :" + devices[i].name + "(" + devices[i].description + ")");
System.out.println(" data link:" + devices[i].datalink_name + "(" + devices[i].datalink_description + ")");
System.out.print(" MAC address:");
for (byte b : devices[i].mac_address) {
System.out.print(Integer.toHexString(b & 0xff) + ":");
}
System.out.println();
for (NetworkInterfaceAddress a : devices[i].addresses) {
System.out.println(" address:" + a.address + " " + a.subnet + " " + a.broadcast);
}
}
JpcapCaptor jpcap = JpcapCaptor.openDevice(devices[1], 2000, true, 20);
jpcap.loopPacket(-1, new packet_cap());
}
两行代码被列为“非声明”,并且被预期为)和}。
for (int i = 0; i < devices.length; i++)
和
System.out.print(Integer.toHexString(b & 0xff) + ":");
我确定这些问题是相关的。
看起来您已经从HTML复制并粘贴了。
for (int i = 0; i < devices.length; i++)
对<
应<
。
还 System.out.print(Integer.toHexString(b & 0xff) + ":");
&
应该是&
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句