NetworkInterface getParent Example
NetworkInterface class getParent example. This example shows you how to use getParent method.
NetworkInterface class getParent example. public NetworkInterface getParent() Returns the parent NetworkInterface of this interface if this is a subinterface, or null if it is a physical (non virtual) interface or has no parent.
Here is the code
/*
* @ # GetParent.java
* A class repersenting use to getParent method
* of URL class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class GetParent {
public static void main(String args[]) throws Exception {
NetworkInterface networkInterface =
NetworkInterface.getByName("eth0");
NetworkInterface interface1 = networkInterface.getParent();
System.out.println(interface1);
}
} |
|