Write java program to find the address of the local machine [Example].

 The program to find the address of the local machine is given below:


import java.net.*;

public class InetAddressExample{

public static void main(String[] args){

try{

InetAddress address = InetAddress.getLocalHost();

        System.out.println(address);

}catch(UnknownHostException e){

        System.out.println(e);

        }

    }

}

Reactions

Post a Comment

0 Comments