import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Enumeration;
public class Main {
public static void main(String args[]) throws SocketException {
Enumeration<NetworkInterface> nets = NetworkInterface
.getNetworkInterfaces();
while (nets.hasMoreElements()) {
NetworkInterface netint = nets.nextElement();
System.out.println("Display name: " + netint.getDisplayName());
System.out.println("Hardware address: "
+ Arrays.toString(netint.getHardwareAddress()));
}
}
}
|