NAME RESOLUTION PROTOCOL

Code: 

import java.io.*;

import java.net.*;

class NameResolution {

    public static void main(String[] args)

    {

        try {

            // IP Address

            InetAddress addr

                = InetAddress.getByName("23.229.203.68");

  

            // Host name

            System.out.println("Host name is: "

                               + addr.getHostName());

  

            // Host Address

            System.out.println("Ip address is: "

                               + addr.getHostAddress());

        }

        catch (UnknownHostException e) {

            System.out.println(e);

        }

    }

}

Output:



Comments

  1. I have never seen such a perfect solution. thank you maa'm

    ReplyDelete
  2. maa'm can i perform this practical on multiple machines?

    ReplyDelete

Post a Comment