Write a java program to find host address [Code]

 The program to find the host address is given below

import java.net.*;

public class GetHostAddress{

public static void main(String[] args){

try{

    InetAddress address   =  InetAddress.getLocalHost();

            System.out.println(address.getHostAddress());

          }catch(Exception e){

                System.out.println(e);

           }

    }

}

Reactions

Post a Comment

0 Comments