NetworkInterface getDisplayName Example
NetworkInterface class getDisplayName example. This example shows you how to use getDisplayName method.
NetworkInterface class getDisplayName example. public String getDisplayName() Get the display name of this network interface. A display name is a human readable String describing the network device.
Here is the code
/*
* @ # GetDisplayName.java
* A class repersenting use to getDisplayName method
* of URL class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetDisplayName {
public static void main(String args[]) throws Exception {
byte b[] = {127, 0, 0, 1};
InetAddress inetAddress = InetAddress.getByAddress(b);
NetworkInterface networkInterface =
NetworkInterface.getByInetAddress(inetAddress);
System.out.println("name of this network interface : "+networkInterface.getDisplayName());
}
} |
Output
| name of this network interface : lo |
|