Ad

How to find IP ADDRESS through java code


                                   FIND IP ADDRESS 

import java.net.InetAddress;

/**
 *
 * @author usman
 */

public class FindIp {
   public static void main(String args[]) throws Exception
   {
      InetAddress myIP=InetAddress.getLocalHost();
         
       /* public String getHostAddress(): Returns the IP
       * address string in textual presentation.
       */ 
        
      System.out.println("My IP Address is:");
      System.out.println(myIP.getHostAddress());
        }
           }


  

   

Post a Comment

0 Comments