Get display name for network interface in Java
Description
The following code shows how to get display name for network interface.
Example
import java.net.NetworkInterface;
import java.util.Enumeration;
// www .j a v a2 s . c om
public class Main {
public static void main(String[] args) throws Exception {
Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface ni = en.nextElement();
System.out.println(" Display Name = " + ni.getDisplayName());
}
}
}
The code above generates the following result.