write a program to find host address of system?

Here we find host address of system. InetAddress class provide the method host(IP) address of any system.An IP address or localHost is represented by 32-bit or 128-bit unsigned number.

				
					import java.net.InetAddress;
import java.net.UnknownHostException;

public class MyHostAddress {
	public static void main(String[] args) throws UnknownHostException {
		InetAddress inetAdd = InetAddress.getLocalHost();
		System.out.println("hostName : " + inetAdd.getHostName() + " hostAddress : " + inetAdd.getAddress()
				+ " localHost : " + inetAdd.getLocalHost());
	}
}
				
			

Output :-
hostName : hello-PC hostAddress : [B@8882e222 localHost : hello-PC/100.100.0.100