The InetAddress class provides methods to get the IP address of a local computer by using method ________.

  • getHostAddress()
  • getIPAddress()
  • getLocalAddress()
  • getLocalHost()
In Java, you can obtain the IP address of the local computer using the getLocalHost() method of the InetAddress class. It returns an InetAddress object representing the local host's IP address. The other options are not used for this purpose.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *