NetworkInterface getName Example
NetworkInterface class getName example. This example shows you how to use getName method.
NetworkInterface class getName example. public String getName() Get the name of this network interface.
Here is the code
/*
* @ # GetName.java
* A class repersenting use to getName method
* of URL class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetName {
public static void main(String args[]) throws Exception {
NetworkInterface networkInterface =
NetworkInterface.getByName("eth0");
System.out.println("Name " +
networkInterface.getName());
}
} |
|