How to find an IP address? code example

Example 1: how to find ip address

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());	
	}
}

Example 2: how to find someone's ip address

Using the Command Prompt. On Windows devices, you can find an IP address for a website with the command prompt. ...
Examine the Header of an Incoming Email. When you want to find someone's IP address, an email from them is one of the best places to check. ...
Use an Online IP Lookup Tool.

Tags: