ip address use code example

Example 1: what is ip address

An internet protocol (IP) address 
allows computers to send and receive information. 
There are four types of IP addresses: 
public, private, static, and dynamic. 
An IP address allows information to be sent and received by the correct parties, 
which means they can also be used to track down a user's physical location.

Example 2: what use of ip addresses

import java.net.InetAddress;
import java.net.UnknownHostException;
public class FindIPaddress {
	public static void main(String[] args) throws UnknownHostException {
		InetAddress a = InetAddress.getLocalHost();
		System.out.println(a.getHostAddress());	
	}
}

Tags:

Java Example