Xiii. Develop A Program Using Inetaddress Class To Retrive Ip Address of Computer When Hostname Is Entered by The User
This Java program uses the InetAddress class to retrieve the IP address associated with a hostname entered by the user. The user enters a hostname, which is passed to the getByName() method to retrieve the InetAddress object. Then the getHostName() and getHostAddress() methods are used to output the hostname and IP address associated with the InetAddress.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100%(1)100% found this document useful (1 vote)
2K views2 pages
Xiii. Develop A Program Using Inetaddress Class To Retrive Ip Address of Computer When Hostname Is Entered by The User
This Java program uses the InetAddress class to retrieve the IP address associated with a hostname entered by the user. The user enters a hostname, which is passed to the getByName() method to retrieve the InetAddress object. Then the getHostName() and getHostAddress() methods are used to output the hostname and IP address associated with the InetAddress.