In this example we are gonna see how to get IP address of a System. The steps are as follows:
1) Get the local host address by calling getLocalHost() method of InetAddress class.
2) Get the IP address by calling getHostAddress() method.
public static InetAddress getLocalHost() throws UnknownHostException: Returns the address of the local host. This is achieved by retrieving the name of the host from the system, then resolving that name into an InetAddress. Note: The resolved address may be cached for a short period of time.
#Java #JavaTutorial #Coding
On this page of the site you can watch the video online Java program to get IP Address with a duration of hours minute second in good quality, which was uploaded by the user Paul Mansour 01 March 2021, share the link with friends and acquaintances, this video has already been watched 128 times on youtube and it was liked by like viewers. Enjoy your viewing!