The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
Systems often run with multiple active network connections, such as wired Ethernet, 802.11 b/g
(wireless), and bluetooth. Some applications might need to access this information to perform the particular network activity on a specific connection.
The
java.net.NetworkInterface
class provides access to this information.
This lesson guides you through some of the more common uses of this class and provides examples that list all the network interfaces on a machine as well as their IP addresses and status.
This page describes a network interface and explains why you might want to use it.
This page contains an example that illustrates how a client program can retrieve all the network interfaces on a machine.
This page shows you how to list the IP addresses assigned to all the network interfaces on a machine.
This page shows you how to determine whether a network interface is running or if the network interface is a loopback interface, a point-to-point interface, or a virtual interface. You can also learn how to determine if the interface supports multicasting.